Wrong symbolic computation

Wrong symbolic computation - Poruke

#1 Objavljeno: 7. 9. 2016. 11:03:15
Martin Kraska

Martin Kraska

1.369 svidjanja u 2.283 postova.

Grupa: 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,56 KiB) preuzeto 1262 put(ova).
mat-sym.PNG
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
1 korisnika je svidelo ovu objavu
Radovan Omorjan 7. 9. 2016. 11:09:00
#2 Objavljeno: 7. 9. 2016. 11:20:15
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: 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 Objavljeno: 7. 9. 2016. 11:34:47
Andrey Ivashov

Andrey Ivashov

2.345 svidjanja u 4.060 postova.

Grupa: 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 korisnika je svidelo ovu objavu
sergio 7. 9. 2016. 12:20:00
#4 Objavljeno: 7. 9. 2016. 12:17:08
Martin Kraska

Martin Kraska

1.369 svidjanja u 2.283 postova.

Grupa: 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.
Technische Mechanik mit SMath Studio: https://link.springer.com/book/10.1007/978-3-658-50592-9
#5 Objavljeno: 7. 9. 2016. 13:57:24
Jean Giraud

Jean Giraud

983 svidjanja u 6.866 postova.

Grupa: 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 Objavljeno: 7. 9. 2016. 17:16:22
Andrey Ivashov

Andrey Ivashov

2.345 svidjanja u 4.060 postova.

Grupa: Super Administrator

Fixed.

4 korisnika je svidelo ovu objavu
Martin Kraska 7. 9. 2016. 19:27:00, NDTM Amarasekera 7. 9. 2016. 23:23:00, Mike Kaganski 8. 9. 2016. 00:57:00, Radovan Omorjan 8. 9. 2016. 02:03:00
#7 Objavljeno: 8. 9. 2016. 09:27:36
Jean Giraud

Jean Giraud

983 svidjanja u 6.866 postova.

Grupa: 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,13 KiB) preuzeto 1096 put(ova).
  • Novi postovi
  • Nema novih postova