solve, roots, RootSecant, Dichotomy

solve, roots, RootSecant, Dichotomy - solve, roots, RootSecant, Dichotomy - Messages

#1 Posted: 11/25/2016 1:22:30 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

This Smath document is hot from bakery. A must to start getting used.
Inversing a function is also 'solving', from another Smath document.
Thanks Alex for your function x^1/3. It puzzled me a bit why it does
not plot in q(x)-g(x). Finally, eval(,) rescues the plot and enables
RootSecant to work fine, presented here as a "utility".

About numerical solvers for this type of application, everything has
been invented, even the square wheel! that runs flat on cycloidal road.
Why so many ? Because maths are so many, so much.

Enjoy, please post your "difficult solve".

Jean

Solve roots_solve RootSecant.sm (38 KiB) downloaded 77 time(s).

1 users liked this post
Davide Carpi 11/25/2016 7:49:00 PM
#2 Posted: 11/25/2016 6:12:38 PM
Alexander O. Melnik

Alexander O. Melnik

127 likes in 494 posts.

Group: Moderator

does not evaluate
JeanSolverstuck.png
1 users liked this post
Davide Carpi 11/25/2016 7:49:00 PM
#3 Posted: 11/25/2016 7:51:16 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Wrote

does not evaluate



You have to change the argument Φ into Φ(1) in both the algorithms (RootSecant and Dichotomy)

2016-11-25 23_47_10-SMath Studio - [Solve%20roots_solve%20RootSecant.sm_].png

Not sure why it magically works in 5346, however in this way has the same behavior in both the versions.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#4 Posted: 11/25/2016 8:08:26 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

Not sure why it magically works in 5346



5346 is much closer to Mathcad algo by name
which is also closely related to Maple "expression".
#5 Posted: 11/25/2016 8:48:28 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Found the cause

In the original algorithm, functions is not passed by the argument (both in 5346 and the latest), because first argument is not declared to be a function (to figure it, you can replace first argument in RootSecant/Dichotomy definition with a non existing variable, like zzz, you will see the worksheet still works in the same way). The link with the functions in the worksheet is given by this definition, just below RootSecant:
2016-11-26 00_39_01-SMath Studio Desktop - [Solve%20roots_solve%20RootSecant.sm_].png

Here is the cause of the different behaviors:

  • In SS 0.97, f(x) is kept as symbolical definition even if f(x) already exists, hence when you call the algorithms the function Φ(x) to solve in the algorithms is the last f(x) defined before the use.
    2016-11-26 00_41_12-SMath Studio Desktop - [Solve%20roots_solve%20RootSecant.sm_].png

  • In SS 0.98, the definition stores the content of f(x), hence then you ask the algorithms to solve always the same function, bracketed in different locations (wrong bracket -> infinite loop).
    2016-11-26 00_48_02-SMath Studio - [Solve%20roots_solve%20RootSecant.sm_].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#6 Posted: 11/26/2016 1:03:15 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Thanks Davide,

Good doctoring for those users post 5346.
In the attached, added "Newton-Raphson Root Derivative method".
1/1 Mathcad code, works great to augment this useful document.

Cheers, Jean

Solve roots_solve RootSecant.sm (118 KiB) downloaded 51 time(s).

#7 Posted: 11/26/2016 2:21:40 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... the cleaned version for your "Numerical solve" classroom.

Solve roots_solve RootSecant.sm (117 KiB) downloaded 65 time(s).
#8 Posted: 11/26/2016 5:36:56 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

I think that using functions without brackets as arguments in defining (or calling) another functions wich uses them (like in Mathcad) is generally a bad idea in SMath The reason is relatively simple. You can have variables and functions having different number of arguments but all with the same name in SMath. That is not possible in Mathcad. I suppose different side effects might be present in SMath by copying Mathcad files - like the one Jean presented. In one version of SMath it might work while in the other version the calculation might be performed indefinitely long.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#9 Posted: 12/1/2016 9:53:00 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Hello Radovan,

Your comment is well posed. However, if it would reveal
that some of the coding attached wouldn't work in recent
Smath build: that is a problem, obliging many work sheets
to be doctored. These three are typical of various algo
constructions.

Jean

0Algo Explain.sm (57 KiB) downloaded 53 time(s).

Genfit Minimize MODEL [Gauss ERRstem].sm (62 KiB) downloaded 49 time(s).

Image Fourier Zoom Smath.sm (435 KiB) downloaded 50 time(s).
#10 Posted: 12/2/2016 4:52:30 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Jean,

It seems your files are working well (no errors reported). The most important thing is that they are good for you and they could be used (or changed) by the other users.

Best Regards,
Radovan

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • New Posts New Posts
  • No New Posts No New Posts