Wrong symbolic computation

Wrong symbolic computation - Messages

#1 Posted: 9/7/2016 11:03:15 AM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

I try to understand what the problem in the given example is. To me, the result highlighted in red looks like a plain bug.

Usually, unexpected results of function evaluation can be avoided by inspecting the actually stored definition in the dynamic assistant.

In the given example, the stored definition looks pretty innocent. Thus, how would you be safe in this situation, except for sticking to the survival rule "never use symbolic optimization".

If you don't want to rely on user's care at evaluation time, you have to enforce this by casting eval() into the definition. This deteriorates the readibility of the documents, makes them more like program code, less like paper and pencil.

I am aware of Davide's great user function tutorial in the online gallery but did not find an explanation for the observed behaviour.

Could the bug be related to some sort of short cut of the type "zero times something is zero"? This is only true if both factors are scalars...

mat-sym.sm (30 KiB) downloaded 28 time(s).
mat-sym.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Radovan Omorjan 9/7/2016 11:09:00 AM
#2 Posted: 9/7/2016 11:20:15 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Martin,

Just to repeat, after so many years of using SMath I just feel we are in some kind of an infinite loop (like on a roller coaster), over and over, and we seek for some escape - but I do not know what the escape really means.

Regards,
Ra
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Posted: 9/7/2016 11:34:47 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3730 posts.

Group: Super Administrator

This is very simple - bug in symbolic library. It thinks that everything that multiplied by zero should result to zero. Bug. Will fix it today in the evening.

Numeric calculation engine has no such issue and that is why eval() helps you. As I already mentioned, eval allows to calculate expression numerically without help from symbolic calculation library.

This is also described here: http://smath.info/bts/Issues/IssueDetail.aspx?id=15. Unfortunately I've missed this ticked earlier.

Thank you!
1 users liked this post
sergio 9/7/2016 12:20:00 PM
#4 Posted: 9/7/2016 12:17:08 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

Wrote

This is very simple - bug in symbolic library. It thinks that everything that multiplied by zero should result to zero. Bug. Will fix it today in the evening.

Numeric calculation engine has no such issue and that is why eval() helps you. As I already mentioned, eval allows to calculate expression numerically without help from symbolic calculation library.



Thanks for the explanation. Great to hear that the fix doesn't require rewriting SMath.
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#5 Posted: 9/7/2016 1:57:24 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Martin, Radovan, Andrey: you are all wrong !

The example is incorrectly setup. You do't multiply
a function by a vector, the other way around: multiply
a vector by a function. Same as 2D rotation, 3D rotation.
Here Mathcad 11 would turn red with an error message.
Vector and function product is NOT commutative.

Jean

VectorFunction Rule.gif
#6 Posted: 9/7/2016 5:16:22 PM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3730 posts.

Group: Super Administrator

Fixed.

4 users liked this post
Martin Kraska 9/7/2016 7:27:00 PM, NDTM Amarasekera 9/7/2016 11:23:00 PM, Mike Kaganski 9/8/2016 12:57:00 AM, Radovan Omorjan 9/8/2016 2:03:00 AM
#7 Posted: 9/8/2016 9:27:36 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

That's what I meant about the rule "object * function".
Please read more in the attached work sheet.

Jean

Forum VectorFunction Rule.gif

2D Plot Multitrace [Vector_Function].sm (20 KiB) downloaded 39 time(s).
  • New Posts New Posts
  • No New Posts No New Posts