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

Notification

Icon
Error

5 Pages123>»
Options
Go to last post Go to first unread
Offline uni  
#1 Posted : 10 November 2010 08:39:50(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
ODE Solvers

SMath Studio compatibility SMath Viewer compatibility mono compatibility Extension page Sources


Functions list: rkfixed(5), Rkadapt(5).

Solvers for Non-Stiff Systems:

rkfixed(init, x1, x2, intvls, D) Uses the fourth-order Runge-Kutta fixed-step method.

Rkadapt(init, x1, x2, intvls, D) Uses the fourth-order Runge-Kutta with adaptive step-size.

Arguments:

- init is either a vector of n real initial values, where n is the number of unknowns (or a single scalar initial value, in the case of a single ODE).
- x1 and x2 are real, scalar endpoints of the interval over which the solution to the ODE(s) is evaluated. Initial values in init are the values of the ODE function(s) evaluated at x1.
- intvls is the integer number of discretization intervals used to interpolate the solution function. The number of solution points is the number of intervals + 1.
- D is a vector function of the form D(x,y) specifying the right-hand side of the system

2019-08-13_17-17-33.png

ODE. Examples.sm (206kb) downloaded 26 time(s).
ODE. Examples.pdf (419kb) downloaded 25 time(s).


See also:

1. Intel ODE Solver Library
2. DotNumerics
3. SADEL
4. Matlab C++ Math Library
5. OSLO
6. lsoda
7. GNU Scientific Library (GSL)

Edited by user 14 August 2019 20:35:05(UTC)  | Reason: Not specified

File Attachment(s):
ODE_manual.pdf (240kb) downloaded 396 time(s).
ODESolvers. Example 1 (rus).pdf (114kb) downloaded 374 time(s).
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 10/11/2010(UTC)
Offline omorr  
#2 Posted : 10 November 2010 14:36:44(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Many thanks uni for this plugin Good

Your examples are very interesting (Russian side of the Forum) and I hope that some additional ODE solvers will be implemented as plugins in the near future.
BTW, I've noted that the function used in rkfixed (Система(t;x) in this example) is tolerant to the argument names (t;x here). Actually, rkfixed will not complain if the variables t and x have been already defined - we should be carefull about it.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#3 Posted : 10 November 2010 16:24:03(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
Quote:
I hope that some additional ODE solvers will be implemented as plugins in the near future.

Now it's not so hard. I'll try to implement odesolversolve() from AlgLib project. At this moment I have some functions from there:
Code:
AlgLib Plugin (based on ALGLIB 3.1.0)

Дополнение обрабатывает следующие вхождения:
al_airy("число") - Returns the Airy function: Ai(x), Ai'(x), Bi(x) and Bi'(x).
al_beta("1:число"; "2:число") - Beta function
al_convr1d("1:вектор"; "2:число"; "3:вектор"; "4:число") - 1-dimensional real convolution.
al_fftc1d("1:вектор"; "2:число") - 1-dimensional complex FFT
al_fftc1dinv("1:вектор"; "2:число") - 1-dimensional complex FFT


I think I can to implement full functionality. Also (if anybody need) it's possible to create plotting functions like: CreateMesh(), CreateSpace(), implicitplot2d() and implicitplot3d().

P.S. Three functions (CreateMesh(), implicitplot2d() and implicitplot3d()) based on SMath programming tools already exists.

Edited by user 10 November 2010 16:38:58(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline omorr  
#4 Posted : 10 November 2010 16:36:37(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Wish you good luck Good

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline frapuano  
#5 Posted : 10 November 2010 17:38:02(UTC)
frapuano


Rank: Advanced Member

Groups: Registered
Joined: 01/08/2010(UTC)
Posts: 115
Man
Italy
Location: Rome

Was thanked: 13 time(s) in 13 post(s)
UNI

will be wonderful if based on your experience you can write ( if possible ) a further tutorial on how to develop a plugin for Smath for super NewBie like me and probably many others.
I have seen that your program is very detailed/commented but would be nice to have a diary of how you have put toghether the bit an pieces to develop the plugin , the difficulties that you have overcome , which are the biggest problem to face in writing a plug in amd the things that one person should be more carefull to succed .

Thanks a lot for your help

Francesco

P.S. In the last months I am following the Smath forum in Russian af far as is possible through the google traslate approach ( from Russian to English ..whose traslation is better then from Russian to Italian my mother tongue) and is really very interesting . Need to try to learn better Russian language ..hope to find something useful to this aim on Internet, I guess that we are missing a universe of knowledge due to ignoring the language
Offline uni  
#6 Posted : 10 November 2010 18:51:21(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
Quote:
will be wonderful if based on your experience you can write ( if possible ) a further tutorial on how to develop a plugin for Smath for super NewBie like me and probably many others.

Unfortunately, I don't have the full manual for plugin development. There is a good video-manual for beginners on wiki: Tutorials for Creating Plugins. I used it and also examples from svn. As I see, in English much more materials on this subject than in Russian or other language.
Quote:
I have seen that your program is very detailed/commented but would be nice to have a diary of how you have put toghether the bit an pieces to develop the plugin , the difficulties that you have overcome , which are the biggest problem to face in writing a plug in amd the things that one person should be more carefull to succed.

"Step by step" instructions you mean? It will depend on type of a plugin and algorithm of function. rkfixed() is a difficult example. The main problem was: how to work with function in a plugin? It is better to begin with simple examples like combin() function from video-manual.

Quote:
In the last months I am following the Smath forum in Russian af far as is possible through the google traslate approach ( from Russian to English ..whose traslation is better then from Russian to Italian my mother tongue) and is really very interesting
I'll try to include all those examples in English in SMath Studio. You can try translate.ru.
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline uni  
#7 Posted : 11 November 2010 22:39:00(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
For testing only: ODESolvers.dll (+ Rkadapt())

Edited by user 22 December 2018 15:45:23(UTC)  | Reason: Not specified

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/11/2010(UTC)
Offline uni  
#8 Posted : 12 November 2010 11:19:55(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
New version: ODESolvers.dll

It works more correctly than previous.

Edited by user 12 November 2010 11:28:23(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline omorr  
#9 Posted : 12 November 2010 13:31:11(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Hello,
uni wrote:
New version: ODESolvers.dll

It works more correctly than previous.

Many thanks for your efforts on making this plugin Thank you
The ODE solvers are on the top of my "wish list".

I tested it a bit and this version is indeed much faster then the previous one.
Here is one of my simple test examples for ODE solvers:

And your solvers worked as expected, thank youGood The previous version was much slower and had a problem with larger "n".
This is also a test for a stiff ODE. As the rkfixed and Rkadapt are not stiff solvers, the result is as presented in the graph. Stiff ODE solver should cope with the situation when y2 is approaching zero.

Here are some of my comments, if you do not mind:
- I am not a programmer but am rather surprised how you managed to get the function as a function parameter (D(t,y) in this case - my congratulations Good . I suppose the side effect is that rkfixed and Rkadapt will be working wrong if this function (D(t,y)) uses t and vector y with t,y previously defined. I thought that the ODE solver will be realized in a similar way like "roots" function.

- I tried to define function D as a multiline function but this will not work.

Anyway, I am very grateful to you for this plugin.

Regards,
Radovan

Edited by user 12 November 2010 13:33:44(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#10 Posted : 12 November 2010 18:17:14(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
Thank you, Radovan.
Quote:
- I tried to define function D as a multiline function but this will not work.

I asked Andrey about it and he has explained a problem. You can try newnew version: ODESolvers.dll

About comments Good feedback is necessary to me to fix errors.
Quote:
I am not a programmer but am rather surprised how you managed to get the function as a function parameter (D(t,y).
It is not so simply to explain in a few words about how I do that. May be later, specially for those who is interested.

Edited by user 12 November 2010 18:38:20(UTC)  | Reason: Not specified

Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline uni  
#11 Posted : 12 November 2010 19:10:21(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
Rkadapt() algorithm. Unfortunately, it doesn't work.
Rkadapt prog.sm

Good

Edited by user 12 November 2010 21:09:52(UTC)  | Reason: Not specified

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 13/11/2010(UTC)
Offline uni  
#12 Posted : 12 November 2010 21:25:51(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
Experiments:
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline omorr  
#13 Posted : 13 November 2010 00:57:49(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Hello uni

uni wrote:
Rkadapt() algorithm. Unfortunately, it doesn't work.
Rkadapt prog.sm


I took a look at this sm file. On the basis of the error message about the function Rkadapt2 - "The matrix element does'nt exist." and by some inspection I think that there might be a mistake about vectors and row matrix. There might be that you used the single index for row matrix regarding it as a vector, and you might forgot to use two instead of one index.

Regards,
Radovan

P.S. I am not able to test the new *.dll at the moment because I do not know how to use it with portable 0.89_8 version (unfortunately, have no possibility to install SMath at my home computer).

Edited by user 13 November 2010 01:29:35(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline omorr  
#14 Posted : 23 November 2010 13:29:21(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Hello uni

I tested a little bit rkfixed and Rkadapt. Here is a simple picture:

It seems, as you mentioned, that Rkadapt will not work with multiline function. However, it is very good that rkfixed will work with it - a bit surprise for me. I also tried to define function f(x,t) by using "eval" - it does not work either with rkfixed or Rkadapt. Due to my previous experience, I thought it would not work. I know that this kind of functions, like you did with rkfixed and Rkadapt, will have troubles due to the SMath way of working. Never mind, I hope that SMath will have tha ability to cope with this kind of problems some day.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline uni  
#15 Posted : 07 May 2013 01:16:42(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
Updated description.
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline omorr  
#16 Posted : 12 May 2013 22:08:39(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Just tried ODE plugin and figured out that it can accept additional parameters after the first two in D(x,y) function of derivatives.
I might miss that feature, but it should be pointed out that this is very nice and useful Good



I hope that some stiff solvers would be available sooner or later Good

Regards,
Radovan
File Attachment(s):
ODE-Lorentz.sm (12kb) downloaded 65 time(s).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 2 users thanked omorr for this useful post.
on 12/05/2013(UTC),  on 13/05/2013(UTC)
Offline uni  
#17 Posted : 12 May 2013 22:48:41(UTC)
uni


Rank: Advanced Member

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

Was thanked: 873 time(s) in 491 post(s)
Oh, you found a bug, well, I'll fix it Good



Usual, in such cases I use a different way of passing parameters, but it doesn't work for this example.

EDIT: I was wrong, it works.

Edited by user 12 May 2013 23:21:30(UTC)  | Reason: Not specified

File Attachment(s):
ODE-Lorentz-uni.sm (14kb) downloaded 57 time(s).
Russia ☭ forever
Viacheslav N. Mezentsev
💰 Support me for plugins development: https://money.yandex.ru/to/410013245578758/100
Offline omorr  
#18 Posted : 12 May 2013 23:41:11(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Originally Posted by: uni Go to Quoted Post
Oh, you found a bug, well, I'll fix it Good Usual, in such cases I use a different way of passing parameters, but it doesn't work for this example.

EDIT: I was wrong, it works.


Actually, I thought this was by design and that I missed it Shok , and now I am pleasantly surprised Good . I would prefer my solution, if you do not mind. This way, and in this case - there is a vector with three dependent variables, the rest are parameters (resulting the matrice with four columns). Your solution would have six variables - (resulting the matrice with seven columns). Your example is like the way it works in Mathcad (I never liked this way). If you need additional parameters you must put it in the vector, and use there derivatives equal to zero - it looks a bit artificial.

I also tried this one and it worked as well Good



Uni, please keep it this way and do not change it OK

Regards,
Radovan

Edited by user 12 May 2013 23:51:50(UTC)  | Reason: Not specified

File Attachment(s):
ODE-Lorentz-2.sm (12kb) downloaded 57 time(s).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 13/05/2013(UTC)
Offline mkraska  
#19 Posted : 13 May 2013 00:26:44(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,511
Germany

Was thanked: 801 time(s) in 514 post(s)
How about this dirty parameter handling...

Edited by user 13 May 2013 00:51:31(UTC)  | Reason: Not specified

File Attachment(s):
Example.sm (13kb) downloaded 79 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 13/05/2013(UTC)
Offline omorr  
#20 Posted : 13 May 2013 08:32:56(UTC)
omorr


Rank: Administration

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

Was thanked: 311 time(s) in 265 post(s)
Thank you Martin,
Originally Posted by: mkraska Go to Quoted Post
How about this dirty parameter handling...

Hmm... why dirty? Do not understand, sorry. This looks quite regular to me, except that it is not flexible. The third parameter must always have the same name as in the definition of D().

Regards,
Radovan

Edited by user 13 May 2013 09:34:23(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Users browsing this topic
Similar Topics
Informative ODE Solvers RK5/Laplace - ODE Solvers RK5/Laplace (Samples)
by mac service 14/06/2019 13:14:16(UTC)
ODE Solvers RK5/Laplace (Samples)
by Jean Giraud 29/12/2018 20:50:46(UTC)
ODE Solvers [Viktor-Valery] (Samples)
by Jean Giraud 28/12/2018 04:47:01(UTC)
Ode solvers implementation (Questions)
by Razonar 30/11/2018 01:09:04(UTC)
ODE solvers? (Feature Requests)
by omorr 20/11/2011 12:44:21(UTC)
5 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.