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

Notification

Icon
Error

Login


3 Pages123>
Options
Go to last post Go to first unread
Offline uni  
#1 Posted : 02 October 2012 14:16:14(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
It seems that now there is all I needed to demonstrate the method. I will try to show step by step how to use the solver. As for the theory, Alexey will help me.

Example 1. Finding extremes: Himmelblau's function:

f(x;y) : (x^2+y-11)^2+(x+y^2-7)^2


sys(4*x^3+4*x*y-42*x+2*y^2-14=0;2*x^2+4*x*y+4*y^3-26*y-22=0;2;1)

P. S. Buchberger's algorithm can solve systems like that much easer.

Edited by user 12 November 2014 09:00:13(UTC)  | Reason: Not specified

File Attachment(s):
Draghilev's method.pdf (289kb) downloaded 195 time(s).
Draghilev's method.sm (371kb) downloaded 163 time(s).
uni attached the following image(s):
Himmelblau function.PNG
WolframAlpha Himmelblau function screen 1.png
WolframAlpha Himmelblau function screen 2.png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 02/10/2012(UTC),  on 02/10/2012(UTC)

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

Offline uni  
#2 Posted : 02 October 2012 17:14:14(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Example 2. Finding roots: System 1.

sys(x^2-y*x+y^2-1=0;sin(5*x^2)+sin(4*y^2)=0;2;1)

Edited by user 24 October 2018 01:18:59(UTC)  | Reason: Not specified

File Attachment(s):
Draghilev's method. Finding roots. System 1.pdf (300kb) downloaded 129 time(s).
Draghilev's method. Finding roots. System 1.sm (351kb) downloaded 123 time(s).
uni attached the following image(s):
WolframAlpha System 1.png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 02/10/2012(UTC)
Offline uni  
#3 Posted : 02 October 2012 17:43:03(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Example 3. Finding roots: System 2.

sys(4*(y-1)^2+(x-1)^2-1=0;y-x*sin(25*x)=0;2;1)

Edited by user 03 October 2012 15:35:25(UTC)  | Reason: Not specified

File Attachment(s):
Draghilev's method. Finding roots. System 2.pdf (107kb) downloaded 109 time(s).
Draghilev's method. Finding roots. System 2.sm (55kb) downloaded 121 time(s).
uni attached the following image(s):
Draghilev's method. Finding roots. System 2.png
WolframAlpha System 2.png
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 2 users thanked uni for this useful post.
on 02/10/2012(UTC),  on 02/10/2012(UTC)
Offline uni  
#4 Posted : 03 October 2012 07:51:52(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Example 4. Finding roots: System 3.


sys(3*x-cos(y*z)-1/2=0;x^2-81*(y+0.1)^2+sin(z)+1.06=0;20*z+e^{-x*y}+1/3*(-3+10*π)=0;3;1)

P.S. The picture was obtained in MC11 and visualized in MC15 (my own implicitplot3d() function).

Edited by user 03 October 2012 15:35:10(UTC)  | Reason: Not specified

File Attachment(s):
Draghilev's method. Finding roots. System 3.pdf (279kb) downloaded 116 time(s).
Draghilev's method. Finding roots. System 3.smz (352kb) downloaded 109 time(s).
uni attached the following image(s):
Draghilev's method. Finding roots. System 3.png
Russia ☭ forever
Viacheslav N. Mezentsev
Offline uni  
#5 Posted : 04 October 2012 06:26:54(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Example 4. Finding roots: System 3 version 0.3 (thanks Alvaro for the optimization of the search function)

Draghilev's method as a single function (dimension >= 2).

Edited by user 04 October 2012 07:08:55(UTC)  | Reason: Not specified

File Attachment(s):
Russia ☭ forever
Viacheslav N. Mezentsev
Offline uni  
#6 Posted : 04 October 2012 07:20:41(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Example 2. Finding roots: System 1 version 0.2 (in one sheet).
File Attachment(s):
Russia ☭ forever
Viacheslav N. Mezentsev
Offline uni  
#7 Posted : 04 October 2012 08:18:16(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
As far as I can see there are no questions. As I said, everything is quite simple - we follow along the curve of n+1 space. Next, I will tell how to choose a start point, direction, and about the restrictions that follow from the method. I hope that the examples will be added.
Russia ☭ forever
Viacheslav N. Mezentsev
Offline omorr  
#8 Posted : 04 October 2012 11:24:17(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 uni,

I tried to use your files explaining how to find extremes of the Himmelblau's function and to apply this to NLS (nonlinear least squares) problem to my example file NLminimization, but without success. As I expected, The Jacobian was the first problem. I struggled many times with obtaining Jacobian of the object function S( b ) , or f( x,y,z ) in this and similar examples, and SMath could not find the derivatives most of the time. For some other cases it was sometimes rather time consuming. It seems to be complex for the SMath engine to apply any Jacobian based minimization to this kind of problem. You could see in the attached file where I stopped.

I do not know if there is any sense to use Jacobian based minimization procedure to these kind of problems in SMath. I would appreciate any comment from you regarding this.

Regards,
Radovan
File Attachment(s):
Draghilev's%20method-NLS.sm (203kb) downloaded 84 time(s).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#9 Posted : 04 October 2012 13:47:37(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Radovan, I think this is not a good idea. This function will have zero determinant in the method.
uni attached the following image(s):
NLS screen 1.PNG
Russia ☭ forever
Viacheslav N. Mezentsev
Offline uni  
#10 Posted : 04 October 2012 14:36:12(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
But it is possible.

P.S. This is not a correct example too, the determinant is zero. The sum of squares must be on all points.

Edited by user 04 October 2012 14:51:41(UTC)  | Reason: Not specified

File Attachment(s):
Russia ☭ forever
Viacheslav N. Mezentsev
Offline omorr  
#11 Posted : 04 October 2012 16:05:42(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 uni,
Originally Posted by: uni Go to Quoted Post
But it is possible.

P.S. This is not a correct example too, the determinant is zero. The sum of squares must be on all points.


Thank you for considering this Good . If you include the sum of squares to your example above, then it is equivalent as finding the roots of this three equations

sum(((el(pp,i)-f(el(xx,i),a1,a2,a3))*diff((f(el(xx,i),a1,a2,a3)),a1)),i,1,n)≡0

sum(((el(pp,i)-f(el(xx,i),a1,a2,a3))*diff((f(el(xx,i),a1,a2,a3)),a2)),i,1,n)≡0

sum(((el(pp,i)-f(el(xx,i),a1,a2,a3))*diff((f(el(xx,i),a1,a2,a3)),a3)),i,1,n)≡0

It is a well known and maybe redundant to say, sorry - the first derivatives over three unknowns (a1,a2,a3) should be zero. The Jacobian of these three equations should not be zero (say, giving all xx different).
The problem is in derivatives, Jacobi matrix etc. (includes summation and quite large expressions). Whenever I tried to solve this root finding problem in SMath, finding derivatives, Jacobian etc. causes the main problem.

Anyway, could you please try to solve with this method the three above equations using your example function, but with more than three points.

Regards,
Radovan

P.S. I just saw that you added smz file as well. I might try myself ass well Good - but have doubts that I would be successful

Edited by user 04 October 2012 16:11:34(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#12 Posted : 05 October 2012 04:54:18(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Radovan, I can't say something in your case. Yes, there is a problem with the Jacobian. I can't understand what exactly is the problem, so we turn to a simple example for now.

Edited by user 05 October 2012 04:55:51(UTC)  | Reason: Not specified

File Attachment(s):
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 05/10/2012(UTC)
Offline uni  
#13 Posted : 05 October 2012 07:51:53(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
I have something fixed in the plugin. Download the new version and try to calculate this example. Everything is the same, but now it sometimes works even with five points. Then the problems begin with the maple().
File Attachment(s):
Draghilev's method. NLS. Example 1.pdf (35kb) downloaded 83 time(s).
Draghilev's method. NLS. Example 1.smz (6kb) downloaded 82 time(s).
uni attached the following image(s):
Draghilev's method. NLS. Example 1.jpg
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 05/10/2012(UTC)
Offline omorr  
#14 Posted : 05 October 2012 09:44:40(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)
Thank you uni for your time,

I also tried your simple example yesterday and was surprised that it worked well, but for some data worked well and for some other did not - as you mentioned.

I will try this new example as soon as your server become available (temporarily down at the moment)

By the way, I bumped many times into the derivative, gradient, Jacobian problem in SMath and almost always had to give it up. I even asked Andrey few times to introduce numerical differentiation in spite of the well known fact that numerical differentiation is prone to numerical errors. Calculating even derivatives (Jacobian is another nightmare) analytically is sometimes almost impossible and there is no other way than using some kind of numerical approximation. Therefore, when Jacobian is involved in some calculation - I always find myself unconfortable Blush Hysterics

Regards,
Radovan

EDIT: You are right - Pressing F9 several times can make it work. The error message was always "Action could not be performed with text" .
By the way, I even get the results of this function

f(x,a):sum((el(a,k)*x^{K-k}),k,1,K)+sin(x)

but after pressing F9 quite a lot of times.

Edited by user 05 October 2012 12:16:25(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#15 Posted : 05 October 2012 15:10:05(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Unfortunately, the plugin can't correctly translate all that much data with which it communicates with the Maple. Do not forget to delete the file mvr5.txt. Here you can see the language in which the plugin communicates with the Maple. And one more example. I increased the dimension of the problem and the number of points.

Edited by user 05 October 2012 15:12:21(UTC)  | Reason: Not specified

File Attachment(s):
Draghilev's method. NLS. Example 2.pdf (39kb) downloaded 81 time(s).
Draghilev's method. NLS. Example 2.smz (7kb) downloaded 84 time(s).
uni attached the following image(s):
Draghilev's method. NLS. Example 2.jpg
Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 05/10/2012(UTC)
Offline omorr  
#16 Posted : 05 October 2012 15:42:50(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)
Thank you uni,

Still pressing F9 lots of time is needed.
Wish you good luck in resolving this problem and improving the plugin Good .

I remember you mentioned that the real benefit SMath will have by developing its own symbolic engine. I hope that the SMath improvement of its engine will happen as well, and in not so a distant future.

Regards,
Radovan

P.S. A minor comment:
By the way, Is there any way that the plugin will follow the naming function convention in SMath (World, Europe). Just a simple example

maple(int(1/sqrt(1-x^2),x))=arcsin(x)

and there is actually World style (asin() instead of arcsin())
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#17 Posted : 05 October 2012 16:09:37(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Press F9 need to generate random numbers. I think that this should be on the expression where it is described (inside it). I get the result after every of 5-7 pushing. You can also increase the spread of the points (instead of a factor of 0.8 to take a little more).
Hmm. As I see it, in SMath used arc*() style, isn't it? (Russian interface) If Europe is different, I need to give a complete list of mathematical functions, where you need to make corrections, and three letters of the interface language (or just language name).

P.S. Radovan, I think that you need something like this: Nonlinear Regression II, Fitting a Curve to a Data Set with the New Gradient Operator

Edited by user 05 October 2012 16:48:31(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
thanks 1 user thanked uni for this useful post.
on 05/10/2012(UTC)
Offline omorr  
#18 Posted : 05 October 2012 18:09:44(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 uni
Originally Posted by: uni Go to Quoted Post
.S. Radovan, I think that you need something like this: Nonlinear Regression II, Fitting a Curve to a Data Set with the New Gradient Operator

Actually, that is the all point Wink . I am quite well acquainted with linear and nonlinear curve fitting in Mathcad. I also have it done for my students for years (in Mathcad and other software). The fact is that SMath does'nt have it Wonder yet. For quite a while I am hopping that those things are going to be made in SMath by some users and plugins. The root solving plugin is developing by w3b5urf3r Non Linear Solvers (root-finding methods) - BDQRF, Bisection, Brent's, Broyden's, Newton-Raphson, Ridder's, Secant, Homotopy . There is no classical optimization procedure needed for nonlinear curve fitting - in that sense I was just trying Draghilev's method.

To be honest, in order to replace Mathcad (Prime) and use SMath completely in my teaching, I need only few more things (like nonlinear curve fitting) but time is passing and I am still waiting Wonder . I have enough time for that, but would like to be ASAP.

It is easily to find out that these few things are needed for majority of the engineering math and modeling problems. SMath's visual capabilities are very attractive for engineering applications.

- system of linear equations (SMath - should be improved)
- system of nonlinear equations (SMath - roots(), not good enough - plugin made by w3b5urf3r)
- system of first order ODE (SMath - plugin made by uni, improving appreciated)
- interpolation (SMath - included, should be improved)
- differentiation, integration (SMath - should be improved)
- linear and nonlinear curve fitting (SMath - not included, neither plugins made)
- 2D and 3D plotting (SMath - should be improved)
- units (SMath - quite good enough)

Unfortunately, in the present state I still do not quite understand how and why SMath is doing some things, I am often puzzled with it - and I do not like that feeling Mad . In order to use it in my teaching I should understand it better. Unfortunately, that is still not the case.

Regards,
Radovan

Edited by user 05 October 2012 18:15:29(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 05/10/2012(UTC)
Offline uni  
#19 Posted : 05 October 2012 18:29:00(UTC)
uni


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 10/11/2010(UTC)
Posts: 1,493
Man
Russian Federation

Was thanked: 1274 time(s) in 745 post(s)
Radovan, if you want to understand it better, then you need to try to write the interpreter symbolic computation by yourself. It's not that hard. There is even an introductory book - Computer Algebra with SymbolicC++.

P.S. On the picture is a simple example of the SMath-style calculator, which is written in VB6: sources (draft, russian).

Edited by user 05 October 2012 18:57:21(UTC)  | Reason: Not specified

uni attached the following image(s):
VB6Calculator.PNG
Russia ☭ forever
Viacheslav N. Mezentsev
Offline omorr  
#20 Posted : 05 October 2012 19:35:51(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)
Sorry, uni - I did not make myself clear enough Blush

I did not mean by "understanding" to know how SMath is working in programming sense in order to make plugins, or things like that. I am to old for that and it is beyond my capabilities. I was just thinking to understand it from the SMath user point of view - in order to use it like a math and engineering tool. I want to use it in order to solve my standard problems that I have in my class, and to understand pretty well how to solve those problems by using SMath. Unfortunately, I am to often getting confused by struggling with its own problems - like symbolic engine, its optimization feature etc. I do not often understand SMath behavior, can not often rely on its results etc. Maybe a much better explanation of our frustrations at the moment gave Martin Kraska (mkraska) in its recent post Post by mkrska.

Quite similar frustrations had and still have Mathcad "oldtimers", but it can not be compared with SMath.
From my point of view, SMath is very, very close to the point of software I always wanted - but it is still not there Sad

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Users browsing this topic
3 Pages123>
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.