Wrong symbolic computation

Wrong symbolic computation - Сообщения

#1 Опубликовано: 07.09.2016 11:03:15
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: 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 КиБ) скачан 31 раз(а).
mat-sym.PNG
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 пользователям понравился этот пост
Radovan Omorjan 07.09.2016 11:09:00
#2 Опубликовано: 07.09.2016 11:20:15
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: 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 Опубликовано: 07.09.2016 11:34:47
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: 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 пользователям понравился этот пост
sergio 07.09.2016 12:20:00
#4 Опубликовано: 07.09.2016 12:17:08
Martin Kraska

Martin Kraska

1222 сообщений из 2150 понравились пользователям.

Группа: 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 Опубликовано: 07.09.2016 13:57:24
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 Опубликовано: 07.09.2016 17:16:22
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: Super Administrator

Fixed.

4 пользователям понравился этот пост
Martin Kraska 07.09.2016 19:27:00, NDTM Amarasekera 07.09.2016 23:23:00, Mike Kaganski 08.09.2016 00:57:00, Radovan Omorjan 08.09.2016 02:03:00
#7 Опубликовано: 08.09.2016 09:27:36
Jean Giraud

Jean Giraud

983 сообщений из 6866 понравились пользователям.

Группа: 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 КиБ) скачан 41 раз(а).
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений