SMath Studio 0.98.5908 (05 March 2016)

SMath Studio 0.98.5908 (05 March 2016) - Messages

#21 Posted: 3/8/2016 9:24:38 PM
Eckhard Bräuchler

Eckhard Bräuchler

0 likes in 2 posts.

Group: User

Hello Andrey!

recently i found out about an issue with the Viewer, might it be possible to fix the update proces while using plugins like the comboboxList?

Please see the example pictures and you see the posibilities of the second list don't change
with the selection made in the first one, wich is non of a problem using
the file with SMath Studio... only with the Viewer it fails.

Thanks a lot for concerning!
I'd appreciate your help very much!

[albumimg]1433[/albumimg]

[albumimg]1432[/albumimg]

[albumimg]1431[/albumimg]

example.zip (428 KiB) downloaded 47 time(s).
#22 Posted: 3/9/2016 1:28:52 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Sergio,

Your example that works elements wise, check for other issue:
vectorise as you did ... SQRT( ... result at the bottom of
the attached work sheet in light red.

Jean

Utilities Matrix Vectorise EXPRESS.sm (56 KiB) downloaded 66 time(s).

... read more as well.
1 users liked this post
sergio 3/9/2016 6:05:00 AM
#23 Posted: 3/9/2016 3:14:21 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

What do you think Andrey to put then invert() function as well in the exception?

Function transpose() will get into the operator but invert() will not. Therefore, there is quite a difference between rising a matrix to a negative power inside vectorize() and having invert() inside vectorize(). For example, we have abs() and det() but inside vectorize() there is visually no difference.

I also hope this will not open some other issues regarding the vectorize() function.

Regards,
Rdovabn
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#24 Posted: 3/9/2016 3:35:36 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I also hope this will not open some other issues regarding the vectorize() function.



Quite right Radovan,

That will require a "task force" checking wrt Mathcad.
The collection of vectorise is huge ! and would be
partial wrt functions not implemented in Smath. In the
mean time, the options in the previously attached
work sheets are VISIBLE. The risk of conflict between
"conventions" and "inventions" is silent/present.
Remember the Smath missing col operator <,> ... +++

Jean

1 users liked this post
Radovan Omorjan 3/9/2016 4:51:00 AM
#25 Posted: 3/9/2016 4:41:44 AM
frapuano

frapuano

13 likes in 115 posts.

Group: User

Jean,
thanks a lot for sharing ...your approach with the algo technique of passing a function ..to a function is very interesting .
It is something I had never thought that was possible to do, it is very elegant and concise.

Thanks again and best regards

Franco
#26 Posted: 3/9/2016 4:58:21 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Wrote

Wrote

I also hope this will not open some other issues regarding the vectorize() function.



Quite right Radovan,

That will require a "task force" checking wrt Mathcad.
The collection of vectorise is huge ! and would be
partial wrt functions not implemented in Smath. In the
mean time, the options in the previously attached
work sheets are VISIBLE. The risk of conflict between
"conventions" and "inventions" is silent/present.
Remember the Smath missing col operator <,> ... +++

Jean



Thank you Jean,

You are right. Although very useful vectorization() might be sometimes quite a headache if used carelessly.
As you pointed out, that means from the users and developers point of view. I suppose that Andrey therefore avoided using it for such a long time.
It might have been like opening Pandora's box.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#27 Posted: 3/9/2016 6:20:16 AM
sergio

sergio

115 likes in 329 posts.

Group: User

thanks Andrey,
Your explanation convinced me. And now I think it is not appropriate to satisfy the misuse that I had indicated: only a shortcut.
Reading the posts received later we understand that the introduction of function vectorize() has created a bit of movement And this is very interesting.

sergio
2 users liked this post
Davide Carpi 3/9/2016 7:58:00 AM, Radovan Omorjan 3/9/2016 8:38:00 AM
#28 Posted: 3/9/2016 12:53:29 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote

Hello, Sergio.

Wrote

[albumimg]1430[/albumimg]


Thank you for pointing it out.

From programmers point of view everything goes correctly here. You tries to transpose every single element of matrix, which is not allowed by the program (as transpose operation can be applied for matrices and vectors only). But on other side I see it will be very handy to have transpose operation in some exceptions list for vectorization.

Will check what I can do...

Best regards, Andrey Ivashov.



First of all - thank you, Andrey, vectorize() can be EXTREMELY useful.

My vote goes for creating no exceptions. Its way easier for end user to understand why vectorize() throws an error (inverse of zero for example), rather than understanding why one "exception" works but not another.

A logically valid workaround is use of eval() inside vectorize - it just makes sense, easy to document and achieves the end goal.

If anything we could use a symbolic alternative of eval() (or does it already exist)?

Cheers All

vectorize1.png
1 users liked this post
Davide Carpi 3/9/2016 1:20:00 PM
#29 Posted: 3/9/2016 1:24:44 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

My vote goes for creating no exceptions. Its way easier for end user to understand why vectorize() throws an error (inverse of zero for example), rather than understanding why one "exception" works but not another.

A logically valid workaround is use of eval() inside vectorize - it just makes sense, easy to document and achieves the end goal.

If anything we could use a symbolic alternative of eval() (or does it already exist)?



That's an interesting and clean approach

Since eval() force evaluation in place, maybe a novectorize() [like noparse in bbcode] may be an alternative to keep the symbolic data



P.S. Still no ideas about this error?
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#30 Posted: 3/9/2016 6:06:57 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote



Since eval() force evaluation in place, maybe a novectorize() [like noparse in bbcode] may be an alternative to keep the symbolic data




.. It might be easier for an unfamiliar person to find the function if it is similar in name to eval(), say eval.sym(); in this case eval.sym() will evaluate the expression symbolically.

The function can be usefull beyound vectorize() (say in passing input to plugins).
#31 Posted: 3/9/2016 7:52:53 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

maybe simply symb() ...

Wrote

The function can be usefull beyound vectorize() (say in passing input to plugins).


I miss the point here, you can pass almost whatever you want to the plugins...
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#32 Posted: 3/9/2016 8:46:11 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

Wrote


I miss the point here, you can pass almost whatever you want to the plugins...



It might be me and my lack of programming skills, but unless I use an eval() on the expression passed to my excel_IN function, it will not cancel out all the units before pasting the value into the EXCEL cell. End result - MESS. Instead of cell value 3138.0096 i get 2.82646777304901*10^19/9007199254741*'kg*'m^2/'s^2*1/10^3*'kg*'m/'s^2*'m (which is actually 3138.0096).

I figured our proposed symb() function can be used in similar way to cancel out units, but preserve symbolic notation.

P.S.: I'm sure I could do it somehow inside the plugin code, I just do not know how... And would not want to get off topic here.
#33 Posted: 3/22/2016 12:06:04 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

I'm not sure if this had been asked:
Currently, it's impossible to create a function like

f(M)=sum(M)

because sum takes only matrices, and M here is unknown type.
Using, say, augment(), which return type is known to be a matrix, I can do this:

f(M)=sum(augment(M))

I cannot use vectorize(), because its return type may be scalar like in vectorize(1), or system.
Though I can use it with eval().

The question is, is it possible to make vectorize always return matrix? When argument is a operation on system, for example, the result type differs from input. Having this could allow for such constructs without evals.
Or maybe allow sum to accept any type of input, making it return input itself if it's scalar/system/string?
scr3.png
С уважением, Михаил Каганский
#34 Posted: 3/22/2016 1:09:26 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

It is unfortunate that eval() prevents vectorize() from evaluating its arguments one-by-one.
For example:

f(x):=(1/x)^2
vectorize(mat(1,2,3,4,2,2))=mat(1,0.25,0.1111,0.0625,2,2)

f(x):eval((1/x)^2)
vectorize(mat(1,2,3,4,2,2))=mat(5.5,-2.5,-3.75,1.75,2,2)

If the expression of vectorize is optimized before by-element evaluation, then it's impossible to use, say, linterp() in such functions, and eval doesn't help.
С уважением, Михаил Каганский
#35 Posted: 3/22/2016 8:55:01 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Vectorise is specific to Mathcad, then new to Smath.
A risky new bugger that does not speak, won't match
Mathcad either ... and almost impossible to exhaust.
We can expect more and more of that in the Forum.

Jean

Forum Vectorise Risky Stuff.gif
#36 Posted: 3/22/2016 9:43:51 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

It is unfortunate that eval() prevents vectorize() from evaluating its arguments one-by-one.
For example:

f(x):=(1/x)^2
vectorize(mat(1,2,3,4,2,2))=mat(1,0.25,0.1111,0.0625,2,2)

f(x):eval((1/x)^2)
vectorize(mat(1,2,3,4,2,2))=mat(5.5,-2.5,-3.75,1.75,2,2)

If the expression of vectorize is optimized before by-element evaluation, then it's impossible to use, say, linterp() in such functions, and eval doesn't help.




... and you have it wrong both ways. Solution is: return Smath to the last working
version [5346], litle simples step of more maths and more conviviality... issue patch.
linterp what ? you just have the Y vector !

Jean

Forum Vectorise Risky Stuff_1.gif


#37 Posted: 3/22/2016 10:42:58 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Thank you Jean for attention.

Though when I read things like that:

Wrote

... and you have it wrong both ways. Solution is: return Smath to the last working
version [5346], litle simples step of more maths and more conviviality... issue patch.
linterp what ? you just have the Y vector !



I start to think that you want to be rude.
I have it wrong both ways? What do you mean by that? Have you read that carefully? First way I get absolutely correct matrix of original numbers raised to power (-2). How is that incorrect? Or do you think that you know my requirements better?

Your method works, and fine. I have mine, working too. But what I write about isn't call for help "Hey! I'm lost in two trees! How do I calculate them?", but a proposal to enable more powerful use of new shiny feature.

"linterp what ? you just have the Y vector !" - I wrote that if some of my function internally uses linterp for some reason, it currently automatically isn't fit for use inside vectorise.

I'm trying to replace a number of loops in my files that are used to fill matrices, with a cleaner syntax of vectorise. And I meet with some limitation that MAY be curable if Andrey decides that it's possible (and that's not too difficult taking into account his code).

Specifically, I attach a file that I tried to cleanup today. One of loops is marked by magenta. It's impossible to rephrase it like is shown to the right of it on margin (highlighted by red), though both Q and t are vectors that I want to be used one-by-one, to get resulting vector of formula results. The problem is that the functions that are used in my top-most function use *interp() on some other matrices, and that makes this syntax illegal. I dream of a proposed here "novectorize" or suchlike...

Regulirujushchijj klapan.sm (232 KiB) downloaded 60 time(s).
С уважением, Михаил Каганский
#38 Posted: 3/22/2016 4:07:26 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

I'm trying to replace a number of loops in my files that are used to fill matrices, with a cleaner syntax of vectorise. And I meet with some limitation that MAY be curable if Andrey decides that it's possible (and that's not too difficult taking into account his code).

Specifically, I attach a file that I tried to cleanup today. One of loops is marked by magenta. It's impossible to rephrase it like is shown to the right of it on margin (highlighted by red), though both Q and t are vectors that I want to be used one-by-one, to get resulting vector of formula results. The problem is that the functions that are used in my top-most function use *interp() on some other matrices, and that makes this syntax illegal. I dream of a proposed here "novectorize" or suchlike...



In the attached, your clean creation of dual vector is suggested. You could probably work a long route by creating the model of T, P data set. By inspection it looks simple polynomial fit. Seeing
ΔP make me think your are trying to compute some MassFlow in association with m^3. You may not have
the appropriate formulation ... which is in construction in my design board, maybe a day or two.
On the other hand ΔP.доЦТП:vectorize(Δp(Q,D,L,Δ.э,t)) is not a function definition.
If I'm correct assuming you try to compute MassFlow, better start working unitless to ease reading.


Regulirujushchijj klapan Notes.sm (292 KiB) downloaded 63 time(s).

#39 Posted: 3/22/2016 7:44:54 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

About foo1 and foo2 you can avoid the evaluation on assignment using a programming function (line()); no ways to use vectorize on linterp

foo.sm (20 KiB) downloaded 67 time(s).

Any further improvement on vectorize is welcome from my side
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
Mike Kaganski 3/22/2016 8:12:00 PM
#40 Posted: 3/30/2016 12:13:03 PM
Ruben Sidranski

Ruben Sidranski

17 likes in 463 posts.

Group: User

The problem is that "vectorize" is not passed through with the function definition
Vectorize.PNG
You will notice that the vectorization "arrow" is missing in the definition of f
  • New Posts New Posts
  • No New Posts No New Posts