Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

3 Pages<123>
Options
Go to last post Go to first unread
Offline kilele  
#21 Posted : 05 October 2012 20:08:24(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 392

Was thanked: 132 time(s) in 113 post(s)
Originally Posted by: omorr Go to Quoted Post


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)




Hi omorr, this is a useful reference for Andrey and plugin developers.
Could you elaborate more each section ? by specifying which features should be added/improved/corrected.
Offline omorr  
#22 Posted : 05 October 2012 20:56:02(UTC)
omorr


Rank: Administration

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

Was thanked: 312 time(s) in 266 post(s)
Hello kilele,

I hope you would not mind, but I suggest you to search the Forum and to see some of my posts. As you could see, there are almost one thousand of them (I sometimes hesitate to post because of being annoying with so many of them). Whatever I would write here, would be repeating the things I already mentioned. By the way, you also mentioned and posted many links to numerical algorithms and methods Good . I respect any developer who is willing to put all those methods and keep them "alive" in SMath, but eventually it will take quite a long time.

Actually, the priorities in SMath development are up to the Andrey's decisions and he knows the best about it.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#23 Posted : 06 October 2012 09:01:19(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
I updated the plugin now works more stable.
File Attachment(s):
Draghilev's method. NLS. Example 2.smz (7kb) downloaded 55 time(s).
uni attached the following image(s):
Draghilev's method. NLS. Example 2.jpg
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 1 user thanked uni for this useful post.
on 06/10/2012(UTC)
Offline omorr  
#24 Posted : 06 October 2012 09:24:32(UTC)
omorr


Rank: Administration

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

Was thanked: 312 time(s) in 266 post(s)
You are right uni, thank you Good

Now, every F9 produces result for your test problem.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#25 Posted : 06 October 2012 17:06:38(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
20 points (~24 sec). I made some little changes in Draghilev() function.
File Attachment(s):
Draghilev's method. NLS. Example 2.smz (7kb) downloaded 49 time(s).
uni attached the following image(s):
Draghilev's method. NLS. Example 2.jpg
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 1 user thanked uni for this useful post.
on 06/10/2012(UTC)
Offline omorr  
#26 Posted : 06 October 2012 18:02:10(UTC)
omorr


Rank: Administration

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

Was thanked: 312 time(s) in 266 post(s)
Hello uni,

It is quite interesting that you've made it working with 20 points Good .
By the way, I've added the sum of squares - just to check how this sum reduces its value.

Regards,
Radovan

omorr attached the following image(s):
Draghilev's method. NLS. Example 2-20.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 06/10/2012(UTC)
Offline uni  
#27 Posted : 06 October 2012 18:17:30(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
Yes, but initial value for a is X0 := stack(1, 1, 1, 1) Umnik Wink

Edited by user 06 October 2012 18:22:31(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline omorr  
#28 Posted : 06 October 2012 19:20:33(UTC)
omorr


Rank: Administration

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

Was thanked: 312 time(s) in 266 post(s)
Originally Posted by: uni Go to Quoted Post
Yes, but initial value for a is X0 := stack(1, 1, 1, 1) Umnik Wink

Sorry, uni, my mistake Blush. Graph distracted me Blush

In this example - this is really amazing Shok

If this could work for a bit more complicates functions - it would be really great Good .

Regards,
Radovan

Edited by user 06 October 2012 19:24:34(UTC)  | Reason: Not specified

omorr attached the following image(s):
daragilev20.png
daragilev20graph.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 07/10/2012(UTC)
Offline kilele  
#29 Posted : 07 October 2012 01:58:38(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 392

Was thanked: 132 time(s) in 113 post(s)
Originally Posted by: omorr Go to Quoted Post


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



Please look at these matlab algorithms:

See pdfpage 112/docpage 90 of this document for a jacobian approximation by finite difference
http://www.dsic.upv.es/d...92/TesisEnriqueArias.pdf

Adaptive Robust Numerical Differentiation (matlab code)
http://www.mathworks.com...umerical-differentiation

Offline uni  
#30 Posted : 07 October 2012 10:49:42(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
Quote:
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


Now I knew where it came from. I also fixed a bug with double index ii. I've used it twice.
File Attachment(s):
Draghilev's method. NLS. Example 2.1.smz (7kb) downloaded 49 time(s).
uni attached the following image(s):
Draghilev's method. NLS. Example 2.1.jpg
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline omorr  
#31 Posted : 07 October 2012 13:20:29(UTC)
omorr


Rank: Administration

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

Was thanked: 312 time(s) in 266 post(s)
Hello uni,

It seems very promising Good

As it is basically a linear regression over parameters (polynomial equation) I just added the result of it - just for checking. The results are very close to each other. It is interesting that the method is working on this problem very well Good
The determinant det((transpose(XX)*XX))=2.40082615642816*10^16is rather far from zero - well conditioned system. I suppose that would be very interesting to see what will happen when this determinant is quite close to zero - ill conditioned system. I suppose that the results must be quite different.

Regards,
Radovan


File Attachment(s):
Draghilev's method. NLS. Example 2.1-omorr.sm (46kb) downloaded 47 time(s).
omorr attached the following image(s):
Dragilevlinreg.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 07/10/2012(UTC)
Offline uni  
#32 Posted : 07 October 2012 13:34:11(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
Quote:
I suppose that would be very interesting to see what will happen when this determinant is quite close to zero - ill conditioned system. I suppose that the results must be quite different.

Yes, it would be interesting. I'll try to find an example. To improve accuracy, we can increase the parameter N. As for the more complex functions, I'm working on it.
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 1 user thanked uni for this useful post.
on 07/10/2012(UTC)
Offline omorr  
#33 Posted : 07 October 2012 14:25:11(UTC)
omorr


Rank: Administration

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

Was thanked: 312 time(s) in 266 post(s)
Hello kilele,
Originally Posted by: kilele Go to Quoted Post
Originally Posted by: omorr Go to Quoted Post


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



Please look at these matlab algorithms:

See pdfpage 112/docpage 90 of this document for a jacobian approximation by finite difference
http://www.dsic.upv.es/d...92/TesisEnriqueArias.pdf

Adaptive Robust Numerical Differentiation (matlab code)
http://www.mathworks.com...umerical-differentiation


Thank you for the links. Actually, that is the point. At the moment, many plugins which rely on symbolic derivative, gradient, Jacobian, Hessian have great chance to fail sometimes due to the SMath symbolic restrictions and features or simply due to a complicated expressions obtained. There were many situations when you can actually have the numerical values of a vector valued function, but you can not have the derivatives of its elements (therefore, can not calculate Jacobian, Hessian etd.) and every method who use this will also fail (take a look for instance at the efforts of w3b5urf3r an the Nonlinear-solvers plugin). We can actually make Jacobian function ourselves (like the one very simple and hardly useful as in the attached example), but I think that is not the point. Numerical derivation methods are quite prone to errors and I would very like that someone make a plugin (based on some more sophisticated algorithms) like the one mentioned in your second link.

Regards,
Radovan

Edited by user 07 October 2012 14:31:21(UTC)  | Reason: Not specified

File Attachment(s):
Jacnum.sm (17kb) downloaded 45 time(s).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#34 Posted : 08 October 2012 12:42:03(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
Radovan, it's really hard to get a solution using the Draghilev method. I do not know how to do it yet.

The solution here is: [28.4502559095434933, -2720.12633981294994, -7.01208324395984839]. Maybe later I'll be able to get it.
uni attached the following image(s):
NLS3.png
NLS screen 2.jpg
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 2 users thanked uni for this useful post.
on 08/10/2012(UTC),  on 09/10/2012(UTC)
Offline omorr  
#35 Posted : 08 October 2012 15:01:52(UTC)
omorr


Rank: Administration

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

Was thanked: 312 time(s) in 266 post(s)
Do not worry about it uni Good ,

I think it is good enough that you solved many other examples including this particular problem Thank you .

Regards,
Radovan

Edited by user 08 October 2012 15:03:52(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 08/10/2012(UTC)
Offline алексей_алексей  
#36 Posted : 08 October 2012 15:38:37(UTC)
алексей_алексей


Rank: Member

Groups: Registered
Joined: 30/09/2012(UTC)
Posts: 27
Russian Federation

Was thanked: 10 time(s) in 5 post(s)
Experience shows that the Draghilev's method is most effective when searching for an infinite set of solutions, when f1 ... fm, x1 ... xn and n>m ...

Originally Posted by: omorr Go to Quoted Post
... not worry... uni Good ,

Be happy.
thanks 2 users thanked алексей_алексей for this useful post.
on 08/10/2012(UTC),  on 08/10/2012(UTC)
Offline uni  
#37 Posted : 09 October 2012 09:48:33(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
Example 2. Finding roots: System 1 (Mathcad 15)

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

Edited by user 09 October 2012 09:52:27(UTC)  | Reason: Not specified

File Attachment(s):
uni attached the following image(s):
Draghilev's method. Finding roots. System 1. Mathcad15 2D.png
Draghilev's method. Finding roots. System 1. Mathcad15 3D.png
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 2 users thanked uni for this useful post.
on 09/10/2012(UTC),  on 09/10/2012(UTC)
Offline uni  
#38 Posted : 11 October 2012 08:01:39(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
Example 5. Finding roots: System 4.


sys(x^2+y^2-8=0;sin(x*y)*sin(exp(x*y))=0;2;1)

I made minor changes to simplify the calculations. Function has become more clear.

Calculation time: ~1.5 min
Roots: 80
File Attachment(s):
Draghilev's method. Finding roots. System 4.pdf (113kb) downloaded 53 time(s).
Draghilev's method. Finding roots. System 4.smz (115kb) downloaded 71 time(s).
uni attached the following image(s):
Draghilev's method. Finding roots. System 4.jpg
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 1 user thanked uni for this useful post.
on 11/10/2012(UTC)
Offline алексей_алексей  
#39 Posted : 11 October 2012 09:13:05(UTC)
алексей_алексей


Rank: Member

Groups: Registered
Joined: 30/09/2012(UTC)
Posts: 27
Russian Federation

Was thanked: 10 time(s) in 5 post(s)
x1^3+x2^3-0.1e-1*sin(1.0001*x1+x2)=0;
One equation with two unknowns or implicitly given function. In the figure we can see the points at which violated the conditions of existence of an implicit function.

Draghilev's method.
x1 and x2 are solutions of this equation and are functions of the arc length, which allows a clear move along places where there are no implicit function in the classically accepted terms …
Offline uni  
#40 Posted : 22 October 2018 23:14:47(UTC)
uni


Rank: Advanced Member

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

Was thanked: 878 time(s) in 493 post(s)
Examples updated.

Draghilev's method. Finding roots. System 0.sm (349kb) downloaded 19 time(s).
Draghilev's method. Finding roots. System 0.pdf (317kb) downloaded 26 time(s).

Draghilev's method. Finding roots. System 1.sm (325kb) downloaded 20 time(s).
Draghilev's method. Finding roots. System 1.pdf (330kb) downloaded 21 time(s).

Draghilev's method. Finding roots. System 2.sm (30kb) downloaded 18 time(s).
Draghilev's method. Finding roots. System 2.pdf (92kb) downloaded 20 time(s).

Draghilev's method. Finding roots. System 3.sm (307kb) downloaded 17 time(s).
Draghilev's method. Finding roots. System 3.pdf (307kb) downloaded 19 time(s).

Draghilev's method. Finding roots. System 4.sm (70kb) downloaded 18 time(s).
Draghilev's method. Finding roots. System 4.pdf (161kb) downloaded 20 time(s).

Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
thanks 2 users thanked uni for this useful post.
on 23/10/2018(UTC),  on 23/10/2018(UTC)
Users browsing this topic
3 Pages<123>
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.