Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Jean Giraud  
#1 Posted : 25 November 2016 19:22:30(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
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 (39kb) downloaded 51 time(s).

thanks 1 user thanked Jean Giraud for this useful post.
on 26/11/2016(UTC)

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Alex M.  
#2 Posted : 26 November 2016 00:12:38(UTC)
Alex M.


Rank: Advanced Member

Groups: Registered
Joined: 03/03/2014(UTC)
Posts: 418
Canada

Was thanked: 125 time(s) in 96 post(s)
does not evaluate
JeanSolverstuck.png
thanks 1 user thanked Alex M. for this useful post.
on 26/11/2016(UTC)
Offline Davide Carpi  
#3 Posted : 26 November 2016 01:51:16(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Originally Posted by: Alex M. Go to Quoted Post
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.

Edited by user 26 November 2016 01:55:35(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Jean Giraud  
#4 Posted : 26 November 2016 02:08:26(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Davide Carpi Go to Quoted Post
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".
Offline Davide Carpi  
#5 Posted : 26 November 2016 02:48:28(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,639
Man
Italy
Location: Italy

Was thanked: 1323 time(s) in 873 post(s)
Found the cause Good

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

Edited by user 26 November 2016 03:03:56(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline Jean Giraud  
#6 Posted : 26 November 2016 07:03:15(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
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 (119kb) downloaded 25 time(s).

Offline Jean Giraud  
#7 Posted : 26 November 2016 08:21:40(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
... the cleaned version for your "Numerical solve" classroom.

Solve roots_solve RootSecant.sm (118kb) downloaded 39 time(s).
Offline omorr  
#8 Posted : 26 November 2016 11:36:56(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
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!"
Offline Jean Giraud  
#9 Posted : 02 December 2016 03:53:00(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
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 (58kb) downloaded 29 time(s).

Genfit Minimize MODEL [Gauss ERRstem].sm (63kb) downloaded 22 time(s).

Image Fourier Zoom Smath.sm (436kb) downloaded 25 time(s).
Offline omorr  
#10 Posted : 02 December 2016 10:52:30(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
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!"
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.