try on error

try on error - Messages

#1 Posted: 5/25/2016 12:48:06 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Hi Uni. Admirable work, thanks a lot for this plugin. Just few questions:

- Not related with your plugin, but ... easy asking you: SMath don't have maple's traperror or mathcad onerror functions?

Have a nice day.

Alvaro.



Saludad Alvaro,

The Mathcad program "on error" looks like to me, it has no Smath equivalent.
If you remember Paul W. "Rotate Image" is essentially working on the final
"on error". I must have spent a day attempting, not to avail.
I have posted everything in this forum "Rotate Image", but no reply.
Mike, atempted but not working in Smath 5346 OFFicial release.

Cheeres, Jean
#2 Posted: 5/25/2016 4:32:05 AM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

- Not related with your plugin, but ... easy asking you: SMath don't have maple's traperror or mathcad onerror functions?



Yes, it is named try(2); this function as for now is available only in nightly build and cloud (since SMath Studio 0.98.5952)

If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 5/25/2016 11:38:10 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

I'm not convinced 'try', 'on error' makes it Mathcad "on error".
The example 1/{-3}+1/{-2}+1/{-1}+1/1+1/2+1/3+1/4+1/5=0.45 works fine.

Easy to check with the latest nightly build, see attached.
The work sheet is "autocal OFF"

Jean

Rotate Image [Mike 16042016].sm (383 KiB) downloaded 60 time(s).
#4 Posted: 5/25/2016 12:23:08 PM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

They works both for me (try/onerror, if/else); slow like how it flows the glass, however the loop runs.

2016-05-25 17_20_17-SMath Studio Desktop - [Rotate%20Image%20[Mike%2016042016].sm_].png

x = 1, y = 1, i = 5, j = -5
error
sum = mat(-6375,-6375,-6375,1,3)
x = 1, y = 1, i = 5, j = -4
error
sum = mat(-11475,-11475,-11475,1,3)
x = 1, y = 1, i = 6, j = -5
error
sum = mat(-19125,-19125,-19125,1,3)
x = 1, y = 1, i = 6, j = -4
error
sum = mat(-25245,-25245,-25245,1,3)
x = 1, y = 2, i = 4, j = -4
error
sum = mat(-4080,-4080,-4080,1,3)
x = 1, y = 2, i = 4, j = -3
error
sum = mat(-7140,-7140,-7140,1,3)
...
...
...
x = 2, y = 7, i = 2, j = 1
sum = mat(379,379,379,1,3)
x = 2, y = 8, i = 1, j = 1
sum = mat(126.333333333333,126.333333333333,126.333333333333,1,3)
x = 2, y = 8, i = 1, j = 2
sum = mat(373,373,373,1,3)
x = 2, y = 8, i = 2, j = 1
sum = mat(625.666666666667,625.666666666667,625.666666666667,1,3)
x = 2, y = 8, i = 2, j = 2
sum = mat(1120.33333333333,1120.33333333333,1120.33333333333,1,3)
...
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Posted: 5/25/2016 8:04:06 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Jean, Uni, Davide. Thanks a lot for your effort and information.
Finally, a traperror for SMath!. That´s great. I'm go to try this "nightly" build, just for have this command. Thanks a lot, Davide.

And Uni, I'm reading your source code and SMath documentation for imagine how to do that.

Best regards.

Alvaro.
#6 Posted: 5/26/2016 1:31:43 AM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Whell, here some applications of try. But a lot of issues implementing it.
Regards.
Alvaro.



Rows$Cols.sm (20 KiB) downloaded 59 time(s).
#7 Posted: 5/26/2016 5:17:04 AM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Wrote

Whell, here some applications of try. But a lot of issues implementing it.



I only see two issues. First two aren't issues.

  1. IsScalar(f): you fail before try(), in IsString(x), where the non-defined f exhibits itself. You must take into account, that f(x):=3*x didn't define symbol f, only symbol f(#), because in SMath, variable, function with one argument, function with two arguments, ... having same name are different entities.
  2. lineRows(a) - here rows(x) actually succeeds, giving symbolic answer: rows(a). try() returns it to line(), which then returns it to evaluator in your numeric "=", where it finally fails. Use eval() here.


Only the pair IsScalarWithoutAnd(x) and IsScalarWithAnd(x) both work wrong. Here, in first definition case, rows() is evaluated symbolically, gives itself (without failing), then the result of try() is considered fixed, thus try(...) is reduced to its "result" - IsScalarWithoutAnd(x)=rows(x). Then this simplified function fails on invocation.
In second definition, the topmost and (&) evaluates its arguments numerically, rows(x) numerically fails because x is undefined, try() intercepts it and returns 0, which is compared to 0, and result (equal=true=1) is anded with 1, which gives ... yes, 1. So, the resulting preprocessed definition looks like IsScalarWithAnd(x)=1 (it always returns same result regardless its argument).

Oh, by the way, diff(x,x) always gives 1. So last function is simplified to IsVariable(x)=1.
С уважением, Михаил Каганский
#8 Posted: 5/26/2016 11:21:13 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

I don't see much use for all those new coding.
"IsScalar" is missing: YES
"ifIsScalar" was added in Mathcad in 2003 [DAEP].
Quite a few suggestions are redundant. I might be missing some real use.

We need the 1/1 Mathcad "on error" as exemplified in "Image Rotate"
Just as is to keep things simple in program.

on error.gif

Every time a new code is developped, it might scrap Smath work sheets
working well in previous version(s). Why not invent a batch run of user
work sheets to enable testing. That supposes an Smath repository and
some voluntary work

Integrate Adaptive.sm (16 KiB) downloaded 37 time(s).

#9 Posted: 5/26/2016 2:53:52 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

I say a lot of issues because developing those simple functions can´t be sure about which is the best implementation before testing it, and need to try (me, not the smath function) a lot of posible combination of implementations. The analysis about when the function go to be evaluated symb or numerically is hard to do for me. So, thanks very much for the explanations. I want an uniform way to define functions, this is, if some Is function have line, then the others too.

About the f, what is an issue for me is not the error when evaluate the last example, is the not-error in the others evaluations.

About the diff, I don't understand when the type check is implemented. diff(x,x) actually is a theorem, a rule or something like that, but type check must to be before any answer.

About this version, I see that my jacobian now don't work: http://en.smath.info/forum/resource.ashx?a=661&b=2 in this old post: http://en.smath.info/forum/yaf_postst1555_Hessian.aspx

Best regards.
#10 Posted: 5/26/2016 5:13:48 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Oh, another thing. For me "variable" is that thing that can you can use second arg in diff. MapleV accept only names, but higher versions also take other things, like vector elements (V[i], for example) which is very very useful. And what I try actually is some kind of independence test. The best independence test that I know is, preciselly, diff(f,x)=0.

And sorry Uni for post this things here, but my original intention was implement try function inside of a script in vb or python, and other functions like Is testing and those others.

Best regards.

Alvaro.
#11 Posted: 5/26/2016 10:31:00 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Oh, another thing. For me "variable" is that thing that can you can use second arg in diff. MapleV accept only names, but higher versions also take other things, like vector elements (V[i], for example) which is very very useful. And what I try actually is some kind of independence test. The best independence test that I know is, preciselly, diff(f,x)=0.

And sorry Uni for post this things here, but my original intention was implement try function inside of a script in vb or python, and other functions like Is testing and those others.

Best regards.

Alvaro.



The way you write "diff(f,x)=0" ... I read 1rst derivative of 'f' wrt 'x'
then equate to 0 for roots. Simple: assign diff(f,x) to a new function,
for instance ff(x):=diff(f,x) ... equate ff(x)=0 for roots.
For the derivative of a vector, if the vector is not smooth you get derivative
+ an immense amount of noise. If the vector is smooth from a function, then get the drivative from the function, then evaluate at points. It could be Maple spline the
vector but that is as bad as good as you know nothing under the hood.

Cheers, Jean

Forum Derivative.gif

#12 Posted: 5/26/2016 11:46:52 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote



The way you write "diff(f,x)=0" ... I read 1rst derivative of 'f' wrt 'x'
then equate to 0 for roots. Simple: assign diff(f,x) to a new function,



Hi Jean. Yes, you're rigth. What I must to wrote was diff(f,x) identically equals zero, i.e. f'(x)=0 for all x in Domain(f). This is the good definition for independence criteria, and, as you say, diff(f,x)=0 is for search critical points.

I found a new nightly build, http://en.smath.info/forum/yaf_postst7576_SMath-Studio-0-98-5990--26-May-2016.aspx, where my jacobian works, but ... with a but. Attached in pdf too.

Best regards.

Alvaro.
File not found.File not found.
#13 Posted: 5/27/2016 3:09:17 AM
Davide Carpi

Davide Carpi

1415 likes in 2872 posts.

Group: Moderator

Wrote

here my jacobian works, but ... with a but.



Opened an issue: SS-2353


Just to remember it, this is the thread of the Script Region plugin; would be better to don't go too much off topic

edit: discussion about try function moved here.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#14 Posted: 5/27/2016 12:23:34 PM
Mike Kaganski

Mike Kaganski

184 likes in 434 posts.

Group: User

Wrote

I have posted everything in this forum "Rotate Image", but no reply.
Mike, atempted but not working in Smath 5346 OFFicial release.



Jean,

I promised not to touch anything you write here, but here you have mentioned a problem that I had helped you to solve, in a manner that makes it look like I failed, so I have to respond.

First, in your message, you failed to provide a link to the topic where that problem was dealt, so that anyone could just look at it themselves, and see that the suggested solution works in timespan of about a minute in 5346 on a modest hardware (my PC gives ~40 s).

Then you provide a file that you name as if it is mine:

Wrote

Rotate Image [Mike 16042016].sm (383 KiB) downloaded 60 time(s).


and actually is an incompetent modification that shows lack of comprehension. Inserting things like "a:=(R+G+/3" into an innermost loop is your footgun that you fire again. I don't mind, unless you blame me with this.

Please go on making useless claims when you declare your wishes as everyone's demand (like "We" in We need the 1/1 Mathcad "on error" as exemplified in "Image Rotate"), but please refrain claiming others failing when describing your endless failures, like everywhere in this forum, or in Mathcad Collaboratory - like that case, that you claimed later as "I defeated my detractors twice and for ever in this Colaboratory" and "I put units in the Reynolds number [unitless] but got result that none could decipher, even Mathsoft".
С уважением, Михаил Каганский
1 users liked this post
уни 5/27/2016 2:42:00 PM
#15 Posted: 5/27/2016 5:08:12 PM
Alvaro Diaz Falconi

Alvaro Diaz Falconi

992 likes in 1674 posts.

Group: User

Wrote

Wrote

here my jacobian works, but ... with a but.



Opened an issue: SS-2353


Just to remember it, this is the thread of the Script Region plugin; would be better to don't go too much off topic

edit: discussion about try function moved here.



Hi Davide. Thanks for move the post and make clean Uni's script plugin.

Best regards.

Alvaro.

  • New Posts New Posts
  • No New Posts No New Posts