[SS-3568] try/onerror issue

[SS-3568] try/onerror issue - Сообщения

#1 Опубликовано: 05.10.2018 15:33:54
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Hi. There are not try-catch here.

Clipboard01.gif

Best regards.
Alvaro.
#2 Опубликовано: 05.10.2018 21:01:23
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

There are not try-catch here.



There are not too many applications in this forum.
It works numerically ... visit this application.

Jean

Image Rotate RGB Copy.sm (349 КиБ) скачан 32 раз(а).
#3 Опубликовано: 06.10.2018 09:21:26
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

This seems to be a workaround for the bug.

Clipboard01.gif

Length_Try_Catch.sm (8 КиБ) скачан 24 раз(а).

Functions like this Length, and equivalents for Rows and Cols are a standard way in Mathcad to check if one works with matrices or scalars, avoiding the use of IsMatrix (absent in SMath at this time), and saving some program steps.

Best regards.
Alvaro.

PD: Try-catch is the name in Maple and others for the SMath try-on error.
1 пользователям понравился этот пост
frapuano 06.10.2018 09:28:00
#4 Опубликовано: 06.10.2018 10:15:00
Davide Carpi

Davide Carpi

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

Группа: Moderator

Added in the BTS as SS-3568


P.S. as for now, if you have custom functions:

2018-10-06 15_14_15-Window.png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Опубликовано: 06.10.2018 23:36:17
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

Added in the BTS as SS-3568


P.S. as for now, if you have custom functions:

2018-10-06 15_14_15-Window.png



Hi Davide. Thanks.
Best regards. For the plugin and for add as issue.
Alvaro
#6 Опубликовано: 07.10.2018 02:32:15
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

With this version of IsMatrix you catch the length for symbolic matrices. Also, avoiding the use of strings have some advantages over the simple version, here as IsMat.

Length.sm (48 КиБ) скачан 38 раз(а).

Clipboard01.gif

Best regards.
Alvaro
#7 Опубликовано: 30.10.2018 12:35:13
Andrey Ivashov

Andrey Ivashov

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

Группа: Super Administrator

Described behavior of the try...catch is by design.

In your example length(x) calculated symbolically and does not raise an error. You can check it by calculating length(x) with symbolic optimization.
To have the behavior you want please use eval(lenght(x)) instead.

Best regards.
#8 Опубликовано: 30.10.2018 16:08:18
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Wrote

Described behavior of the try...catch is by design.

Best regards.



Hi Andrey. Thanks for the clarification. I guess that the origin of this behavior is from about which is the "default unassigned variable type" in SMath. In maple and mathcad it is a complex number, but in SMath it seems to be a matrix or anything else:

Clipboard03.gif

If this is the case, it's correct to return rows, cols and length as an error in numerical evaluations and unevaluated form in symbolic ones.

For other side, it seems that if actuate like having something like evalb (maple's eval boolean), forcing the numerical evaluation, as it is showed in the yellow regions, and widely apply in the attached. This behavior is very useful, at least to me, because enable following routines for Length, Rows, Cols, IsMatrix (without using num2str which causes some issues for some applications) and others useful tools, which yield the same result for numeric and symbolic evaluations, making more easy the live to me.

Length.sm (61 КиБ) скачан 40 раз(а).

Best regards.
Alvaro.

PD: It seems that in the attached file I change the default font color, but don't know how, neither how to revert it to black.
1 пользователям понравился этот пост
frapuano 31.10.2018 03:18:00
#9 Опубликовано: 31.10.2018 07:40:04
Davide Carpi

Davide Carpi

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

Группа: Moderator

Wrote

Hi Andrey. Thanks for the clarification. I guess that the origin of this behavior is from about which is the "default unassigned variable type" in SMath. In maple and mathcad it is a complex number, but in SMath it seems to be a matrix or anything else


Unassigned variables are considered as unknown type; there were problems in the past because they were consider scalar or matrices...

Clipboard03.gif
I suggest to open a separate correction request here or in the bug tracker to improve behavior of length/rows/cols when a matrix contains unknowns...
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 пользователям понравился этот пост
Alvaro Diaz Falconi 31.10.2018 21:57:00
#10 Опубликовано: 31.10.2018 19:22:50
Jean Giraud

Jean Giraud

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

Группа: User

... plenty of things will reflect in "on-error"

Maths on_error.sm (15 КиБ) скачан 30 раз(а).
#11 Опубликовано: 31.10.2018 22:06:16
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Hi Davide. Thanks for your answer.

Wrote


Unassigned variables are considered as unknown type; there were problems in the past because they were consider scalar or matrices...



Good to know. So, the results for rows, length, etc. it's correct. I don't have enough time nor ideas about how to test try...on error function, but guess that it is correcto too.

Wrote


I suggest to open a separate correction request here or in the bug tracker to improve behavior of length/rows/cols when a matrix contains unknowns...



Thanks for the suggestion. But don't know what could be more convenient. For instance, maple have evalb (booleans), evalm (matrix, but obsolete in news versions), evalc (complexes) and some others for modify the way that evaluations are done. Also, the eval maple's function is like the "at" function in the Custom Functions plugin. So, maybe instead of modify rows and those functions, could be more practical introduce a second argument for eval, of the type of "complex", or "scalar", or "matrix" or things like this. Or maybe there are some simplify function under development which can handle those cases, or ... I actually don't know enogh for say which is the best path to follow.

Best regards.
Alvaro.
#12 Опубликовано: 02.11.2018 15:58:04
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Described behavior of the try...catch is by design.



What should it do that is missing ? Catch errors piecewise in program ?

Cheers ... Jean
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений