NonlinearSolvers plugin

NonlinearSolvers plugin - BDQRF, Bisection, Brent's, Broyden's, Newton-Raphson, Ridder's, Secant, Homotopy - Сообщения

#61 Опубликовано: 28.09.2012 05:05:06
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

Sorry Uni, I don't understand your pdfs


I'm sorry, maybe it will be clearer: http://stocktrader10.tripod.com/
Цитата

This Web site is a good spot to let visitors know the math method developed by Russian scientist Anatoly V.Draghilev
This page was last updated on 06/06/02 .
e-mail :Alexey Ivanov [stitch_design@rambler.ru]



Page 1, page 2, page 3, page 4, page 5

Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
Radovan Omorjan 28.09.2012 07:30:00, Davide Carpi 28.09.2012 06:21:00
#62 Опубликовано: 28.09.2012 05:57:51
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

One more example (rus): link

Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
Radovan Omorjan 28.09.2012 07:31:00, Davide Carpi 28.09.2012 06:20:00
#63 Опубликовано: 28.09.2012 06:17:44
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

And some video:
Russia ☭ forever, Viacheslav N. Mezentsev
#64 Опубликовано: 28.09.2012 07:17:57
Ioan

Ioan

1 сообщений из 26 понравились пользователям.

Группа: User

Wrote



Ioan,
[/b]



Hi Ioan

The HRE functions need 2 arguments, no more (see the attachment).

The initial unknown guess strategy It's a common issue, Homotopy and Bisection I think they are the best approaches.

Note that in your script a "large" bound it's better than a little bound.


best regards,

w3b5urf3r

P.S. in the previous post I've reupdated the plugin, the previous librery have a little issue with the x variable, when already defined








Hi w3b5urf3r,



Thanks for your suggestion.

Due to a wide range of parameters, I followed your suggestion by making two steps:
* one to identify the function sign changing and;
* one for finding the right solution.

I included two home-made routines (see attached file), one based on the chord method and the other based on the Newton (Broyden ?) method.

I called the plugin giving to it my initial guess values, the same as for my routines.
I've seen that for some situations no solution is founded with the plugin, while my routines give enough accurate solution.

Of course, I understand that the main objective of the plugin is the equation systems, but I believe that it could be useful also for the particular case of single equations.

Hoping to be useful.


Best regards,

Ioan








longflamb eq mid.sm (40 КиБ) скачан 64 раз(а).
#65 Опубликовано: 28.09.2012 08:39:03
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello uni,
Wrote

And some video:


I do not know how I did miss that on the Russian side

It is very interesting and I will definitely pay more attention to your posted examples.In the meantime, just wanted to ask something. It might be a stupid question, therefore i excuse myself in advance

You solved few nonlinear systems, nonlinear equations, found the function extrema and it looks, how to say, very exotic
As far as understood at a first glance, to realize this method - functions gradients and solving ODE initial value problem is the main constituent and the main problematic part of the method and of the potential plugin . I might be totally wrong, of course because I did not explore it yet.

I do not know how would this method behave with, say 10x10 system of equations? Do you have any experience with something like this?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#66 Опубликовано: 30.09.2012 04:09:40
алексей

алексей

17 сообщений из 78 понравились пользователям.

Группа: User

Hello!
One more example, the system was solved by a Draghilev's method for practically all positive (L,x) :
(1+exp(-2*L*x))*cos(L*x)+2*exp(-L*x)=0; http://forum.exponenta.ru/viewtopic.php?p=55406#55406
Excuse me, I do not know English. I think, uni will help me…
Description of the method:
http://forum.exponenta.ru/viewtopic.php?t=3892&start=0&sid=616ac92e0e41288833d51ba26c338d0f
1 пользователям понравился этот пост
Davide Carpi 01.10.2012 12:39:00
#67 Опубликовано: 01.10.2012 02:07:48
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 сообщений из 1708 понравились пользователям.

Группа: Moderator

Wrote

You solved few nonlinear systems, nonlinear equations, found the function extrema and it looks, how to say, very exotic
As far as understood at a first glance, to realize this method - functions gradients and solving ODE initial value problem is the main constituent and the main problematic part of the method and of the potential plugin .


Well, I'll explain how it works and what you can do with it. But first I need to finish MapleWrapper plugin.
In order to explain I need the two plugins: ODESolvers and MapleWrapper. One would be to calculate the Jacobian, and the second to solve an ODE. This is not exotic, but rather simple things, as you will see.
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Radovan Omorjan 01.10.2012 02:50:00
#68 Опубликовано: 01.10.2012 02:56:33
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Thank you very much

I am looking forward to it.

By the way, you know that I appreciate very much that you made ODEsolvers plugin. Hope that you would have the time to add some "stiif" ODE solver in the future.

Wish you all the best and good luck

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 пользователям понравился этот пост
#69 Опубликовано: 01.10.2012 07:56:10
алексей

алексей

17 сообщений из 78 понравились пользователям.

Группа: User

Wrote

Hello!
One more example, the system was solved by a Draghilev's method for practically all positive (L,x) :
(1+exp(-2*L*x))*cos(L*x)+2*exp(-L*x)=0; http://forum.exponenta.ru/viewtopic.php?p=55406#55406
Excuse me, I do not know English. I think, uni will help me…
Description of the method:
http://forum.exponenta.ru/viewtopic.php?t=3892&start=0&sid=616ac92e0e41288833d51ba26c338d0f



Uni has promised to help with explanations...
System of equations whose solution is converted into an animation of the mechanism.
x1^2+x2^2+(x3+.5*sin(10*x1)-3)^2-4=0;
x2-x1=0;
x5-x6=0;
x5-3=0;
(x1-x4)^2+(x2-x5)^2+(x3-x6)^2-20.1=0;
Maple.Draghilev's method.
#70 Опубликовано: 01.10.2012 09:59:36
kilele

kilele

133 сообщений из 397 понравились пользователям.

Группа: User

@uni

The method you mentioned seems to be the same as the one used in the two pdf papers I linked above, it's an homotopy, differentiated to form an IVP.
One of the pdf I linked contains an implementation of the algorithm solved with classic Runge-Kutta order4 formulas for the IVP (RK4 is said to have a good balance between cost and precision). I'm sure that w3b5rfer might be implementing it for the next version of his plugin.

As for a function for stiff odes, there you have a .NET library (pity it's gpl licensed, at least you can see which algorithms are used).
http://www.dotnumerics.com/NumericalLibraries/DifferentialEquations/Default.aspx


EDIT:
Feel free to contact the author if someone wants to use dotnumerics,
I might be wrong as for the license issues to develop open source plugins for a closed software (though non-comercial) as it is SMath.

EDIT:
I've read that this BDF implementation in C (for Stiff IVP) is good, see "GEAR.H" , "GEAR.CPP" and "MGEAR.CPP"
http://jean-pierre.moreau.pagesperso-orange.fr/c_eqdiff.html
3 пользователям понравился этот пост
Вячеслав Мезенцев 01.10.2012 19:34:00, Davide Carpi 01.10.2012 12:37:00, Radovan Omorjan 01.10.2012 10:10:00
#71 Опубликовано: 01.10.2012 10:22:58
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

PLUGIN UPDATED :d

- new feature: solvers for systems of equations now accept multiple unknowns names (introduced in the latest BETA + new fixes);

- Broyden convergence criterion revisited (introduced in the latest BETA);

- added HRE.RK(...) (Homotopy root-estimation method, using the Runge-Kutta 4th order algorithm);

- all homotopy algorithms now works as Broyden() and NewtonRaphson() (4 required arguments and a 5th optional argument - see the attachment);

- previous HRE() renamed as HRE.NR();

- plugin Jacobian(...) unlocked (introduced in the latest BETA + new fixes);

- fixed issues with Units in all HRE() solvers.


regards,

w3b5urf3r
SMath Studio - [HRE_testing.sm].png
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 пользователям понравился этот пост
Radovan Omorjan 01.10.2012 15:47:00
#72 Опубликовано: 01.10.2012 11:53:38
алексей

алексей

17 сообщений из 78 понравились пользователям.

Группа: User

The most simple example to illustrate Draghilev's method:
x1^2-x2*x1+x2^2-1=0;
sin(5*x1^2)+sin(4*x2^2)=0;
x01 := 0.;
x02 := 1.;
Maple.
1 пользователям понравился этот пост
#73 Опубликовано: 02.10.2012 01:51:29
adiaz

adiaz

5 сообщений из 25 понравились пользователям.

Группа: User

Very nice work. Just some little observations. You use the same epsilon for both x and y axis. The exit code for some functions is min(y)
Regards.

Alvaro.
#74 Опубликовано: 02.10.2012 06:16:22
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Wrote

PLUGIN UPDATED :d

- new feature: solvers for systems of equations now accept multiple unknowns names (introduced in the latest BETA + new fixes);

- Broyden convergence criterion revisited (introduced in the latest BETA);

- added HRE.RK(...) (Homotopy root-estimation method, using the Runge-Kutta 4th order algorithm);

- all homotopy algorithms now works as Broyden() and NewtonRaphson() (4 required arguments and a 5th optional argument - see the attachment);

- previous HRE() renamed as HRE.NR();

- plugin Jacobian(...) unlocked (introduced in the latest BETA + new fixes);

- fixed issues with Units in all HRE() solvers.



Just a little bit of testing with one my "nightmare" problem. I've mentioned this example already. I think this is one more of the SMath symbolic engine problem, and it my happen that you can define a vector function but can not obtain the Jacobian of it. See the attached file and the picture. I managed to solve this problem initially with HR.B() to get better guess values and then Broyden() could do the job. As I do not know how to force SMath to perform all the symbolic operations (for instance, all the operations inside stack() function - among other things), it seems that HR.B() and Broyden() in these situations are the only way of performing similar things . At the end of the file I did all the things about defining the function manually, and then the situation changed drastically. Anyway, I am satisfied that some progress has been made about this

Regards,
Radovan
Primer4.7w-1.png
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#75 Опубликовано: 02.10.2012 10:04:09
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Hi omorr,

I've seen you're example, unfortunately there are many little "issues" regarding the symbolic engine...

For example observes the first element of your f1(), f2() and f3() (look the attachments);

f1()

SMath seem unable to make a symbolical stack of the function; It's not difficult to understand why... the columns of the results matrix (if all it's correct) are the columns of the last stack argument -> 1; the rows are undefined because if [MATH lang=eng]el(X#,2)[/MATH],[MATH lang=eng]el(X#,4)[/MATH],[MATH lang=eng]el(X#,5)[/MATH] and [MATH lang=eng]el(X#,3)[/MATH] are vectors, the result is a vector... exluding the assumption that all unknown elements are numbers or a "size predeclaring", probably the issue could be solved using a "trial and error" procedure on the unknown size, but I think it's a very hard task

f2()
Here there are SMath issues with derivatives... probably it's the same issue of f3() (and the same of this bug), IMHO all related to the symbolic simplification engine...

f3()
Here there are SMath issues with derivatives and elements...


Since all the issues with derivatives involving the Jacobian, so NewtonRaphson(), HRE.NR() and HRE.RK() in this example can not be used (at the moment, at least)


Wrote

For bisection maybe is better not having both epsilon and maxiters, with only one is enough


I don't agree, because with discontinuous functions (f.e. tan(x)) the maxiters prevents infinite loops.

bisection failure

regards,

w3b5urf3r
Primer4.7w-debug.sm (145 КиБ) скачан 55 раз(а).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#76 Опубликовано: 02.10.2012 11:22:53
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2052 понравились пользователям.

Группа: Moderator

Hello w3b5urf3r,

Thank you for your answer an I agree with you completely. We also can see that many of us on this Forum have to many "why?" regarding symbolic engine .

To be honest, Mathcad drives me crazy for almost 25 years and it would be fair that I could give a chance to SMath for the next 20 years or so :d

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#77 Опубликовано: 03.10.2012 00:32:16
adiaz

adiaz

5 сообщений из 25 понравились пользователям.

Группа: User

Wrote



Wrote

For bisection maybe is better not having both epsilon and maxiters, with only one is enough


I don't agree, because with discontinuous functions (f.e. tan(x)) the maxiters prevents infinite loops.
w3b5urf3r



Epsilon and maxiters for bisection is redundant. Even it's more easy with maxiters, is better to take Epsilon (one for each axis, but that is not related with maxiters redundance). In the code maxiters is calculated as N. Actually, the main loop can be implemented with a for loop.

Regards.

Alvaro.
BIS_02.gif
#78 Опубликовано: 03.10.2012 02:46:55
алексей

алексей

17 сообщений из 78 понравились пользователям.

Группа: User

f1 := 3.*x-cos(y*z)-0.5;
f2 := x^2-81.*(y+0.1)^2+sin(z)+1.06;
f3 := 20.*z+(e^(-x*y)+(-3.+10.*Pi)/3.

1)x=0.499999999686162; y=-6.029115021 10^-10; z=-0.523598775196563;
2)x=0.498144680773833; y=-0.199605897856040; z=-0.528825978056676
f1=-1 10^-9;
f2=1.0 10^-8;
f3=1 10^-8;
#79 Опубликовано: 03.10.2012 05:40:37
kilele

kilele

133 сообщений из 397 понравились пользователям.

Группа: User

@Alvaro

Do you think these methods based on bisection could be useful for non-linear systems ?
They don't need differentiability of function, and convergence is guaranteed.
This is a generalized bisection which could be used like HRE for initial root estimation:
https://dl.dropbox.com/u/3152568/A%20Rapid%20Generalized%20Method%20of%20Bisection%20for.pdf
This is a minimization algorithm based on bisection which is said to be an alternative to Nelder-Mead
https://dl.dropbox.com/u/3152568/A%20Multidimensional%20Bisection%20Method_E.Y.Morozova.pdf
1 пользователям понравился этот пост
Radovan Omorjan 03.10.2012 07:45:00
#80 Опубликовано: 03.10.2012 07:43:49
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

Wrote

Epsilon and maxiters for bisection is redundant. Even it's more easy with maxiters, is better to take Epsilon (one for each axis, but that is not related with maxiters redundance). In the code maxiters is calculated as N. Actually, the main loop can be implemented with a for loop.

Regards.

Alvaro.



Ahhhh, previously I understood that you wanted to remove completely (in the function) the maxiter, not to replace it with the number of iterations provided... you're right, excuse me

BTW the plugin single equations solvers actually supports the 2nd Epsilon, but I have not yet updated the reference sheets.


regargds,

w3b5urf3r
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений