DotNumerics

DotNumerics - Initial-value problem for nonstiff and stiff ordinary differential equations ODEs - Poruke

#1 Objavljeno: 13. 7. 2013. 03:50:08
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

DotNumerics

SMath Studio compatibility SMath Viewer compatibility mono compatibility Extension page Sources


Functions list:

Prikaži spoiler



Differential Equations. Initial-value problem for nonstiff and stiff ordinary differential equations ODEs (explicit Runge-Kutta, implicit Runge-Kutta, Gear’s BDF and Adams-Moulton).

Solvers for Non-Stiff Systems:

dn_AdamsMoulton(init, x1, x2, intvls, D) solves an initial-value problem for nonstiff ordinary differential equations using the Adams-Moulton method.

dn_ExplicitRK45(init, x1, x2, intvls, D) solves an initial-value problem for nonstiff ordinary differential equations using the explicit Runge-Kutta method of order (4)5.


Solvers for Stiff Systems:

dn_ImplicitRK5(init, x1, x2, intvls, D) solves an initial-value problem for stiff ordinary differential equations using the implicit Runge-Kutta method of order 5.

dn_GearsBDF(init, x1, x2, intvls, D) solves an initial-value problem for stiff ordinary differential equations using the Gear’s BDF method.


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

Options:

- AbsTol - absolute tolerance parameter, default value 10⁻⁷.
- RelTol - relative tolerance parameter, default value 10⁻⁴.



Links:

1. DotNumerics is a website dedicated to numerical computing for .NET. DotNumerics includes a Numerical Library for .NET. The library is written in pure C# and has more than 100,000 lines of code with the most advanced algorithms for Linear Algebra, Differential Equations and Optimization problems. The Linear Algebra library includes CSLapack, CSBlas and CSEispack, these libraries are the translation from Fortran to C# of LAPACK, BLAS and EISPACK, respectively.

2. Arenstorf orbit. Numerical Analysis: Theory and Applications. Proseminar, 28.03.2011, UIBK [pdf].

3. How to find spatial periodic orbits around the Moon in the TBP.

Books:

1. Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems.

Solving Stiff ODE book.JPG

Examples:

Test_GearsBDF.png DotNumerics. Example 3.png DotNumerics. Example 4.png Arenstorf orbit.JPG

2018-12-24_17-06-48.png 2018-12-25_04-33-23.png 2018-12-25_04-34-24.png dn.ode.test2.png dn.ode.test1.png 2018-12-24_17-07-41.png

dn.ode.kinetic1.sm (8,26 KiB) preuzeto 2058 put(ova).
dn.ode.kinetic2.sm (12,59 KiB) preuzeto 1930 put(ova).
dn.ode.kinetic3.sm (12,28 KiB) preuzeto 1998 put(ova).
dn.ode.test1.sm (19,58 KiB) preuzeto 2005 put(ova).
dn.ode.test2.sm (18,88 KiB) preuzeto 1988 put(ova).
dn.ode.Amplitude detector.sm (20,17 KiB) preuzeto 2026 put(ova).

dn.ode.kinetic1.pdf (77,42 KiB) preuzeto 1150 put(ova).
dn.ode.kinetic2.pdf (93,05 KiB) preuzeto 1072 put(ova).
dn.ode.kinetic3.pdf (91,31 KiB) preuzeto 1067 put(ova).
dn.ode.test1.pdf (115,72 KiB) preuzeto 1048 put(ova).
dn.ode.test2.pdf (120,44 KiB) preuzeto 1033 put(ova).
dn.ode.Amplitude detector.pdf (148,87 KiB) preuzeto 1091 put(ova).

See also:

● [topic=726]Mathcad Toolbox[/topic]
● [topic=13809]SADEL[/topic]
● [topic=1970]Matlab C++ Math Library[/topic]
● [topic=17063]OSLO[/topic]
● [topic=17067]lsoda[/topic]
● [topic=1997]GNU Scientific Library (GSL)[/topic]
DorNumerics. ODE. Arenstorf orbit.sm (91,95 KiB) preuzeto 1845 put(ova).
Russia ☭ forever, Viacheslav N. Mezentsev
4 korisnika je svidelo ovu objavu
Davide Carpi 14. 7. 2013. 09:00:00, ioan92 13. 7. 2013. 06:54:00, Radovan Omorjan 13. 7. 2013. 07:01:00, IVR 13. 7. 2013. 05:01:00
#2 Objavljeno: 14. 7. 2013. 03:15:34
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Wrote

Thank you uni,

dn_GearsBDF might be the ODE solver of choice for SMath. I would not mind some more solvers as well

Regards,
Radovan



Updated. dn_AdamsMoulton(), dn_ExplicitRK45(), dn_ImplicitRK5() added.

In Russia we say: получите, распишитесь.
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
Radovan Omorjan 14. 7. 2013. 05:28:00
#3 Objavljeno: 14. 7. 2013. 05:41:33
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: Moderator

uni,

If you are by any chance here on Thassos-Greece (I am here with my family on the vacation) just let me know and come for a beer

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 korisnika je svidelo ovu objavu
Вячеслав Мезенцев 14. 7. 2013. 08:45:00
#4 Objavljeno: 14. 7. 2013. 08:55:08
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

You're a lucky man, on Greek island with beer and I'm in Siberia with the bears
Russia ☭ forever, Viacheslav N. Mezentsev
#5 Objavljeno: 14. 7. 2013. 08:56:35
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: Moderator

By the way uni,

I am just curious how is the numerical accuracy controlled in all your solvers? There is no any additional parameter about this, or I was wrong about it?.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#6 Objavljeno: 14. 7. 2013. 08:59:20
Davide Carpi

Davide Carpi

1.444 svidjanja u 2.936 postova.

Grupa: Moderator

Wrote

You're a lucky man, on Greek island with beer and I'm in Siberia with the bears



If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Objavljeno: 14. 7. 2013. 09:04:02
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Wrote

By the way uni,

I am just curious how is the numerical accuracy controlled in all your solvers? There is no any additional parameter about this, or I was wrong about it?.

Regards,
Radovan



For all methods the following values​​:

RelTol = 1.0E-4,
AbsTol = 1.0E-7

I will add the ability to change it. I think, using variables in the document: RelTol and AbsTol.
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
Radovan Omorjan 14. 7. 2013. 09:09:00
#8 Objavljeno: 14. 7. 2013. 09:08:34
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: Moderator

Wrote

Wrote

You're a lucky man, on Greek island with beer and I'm in Siberia with the bears





Just imagine how different we are?. My "Lord of the ring" bring us here - me and our children, and I am most interested to "chat" here with you about the ODE solvers . Someone will say that I am crazy - my wife a.k.a "Lord of the Ring" would be the first one .

Regards,
Radovan

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 korisnika je svidelo ovu objavu
Davide Carpi 14. 7. 2013. 09:29:00
#9 Objavljeno: 14. 7. 2013. 09:30:28
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: Moderator

Wrote

Wrote

By the way uni,

I am just curious how is the numerical accuracy controlled in all your solvers? There is no any additional parameter about this, or I was wrong about it?.

Regards,
Radovan



For all methods the following values​​:

RelTol = 1.0E-4,
AbsTol = 1.0E-7

I will add the ability to change it. I think, using variables in the document: RelTol and AbsTol.


I must be annoying now , but could you try please try to reduce this numbers just a bit and try my "famous" example with bioreactions. I used recently some ODE stiff solvers from a package inside R. They gave the same results with negative concentration. Then, I reduced the default values for the accuracy and it worked a bit longer, but gave me the expected zero concentration.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#10 Objavljeno: 14. 7. 2013. 14:52:57
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Wrote

Wrote

Wrote

By the way uni,

I am just curious how is the numerical accuracy controlled in all your solvers? There is no any additional parameter about this, or I was wrong about it?.

Regards,
Radovan



For all methods the following values​​:

RelTol = 1.0E-4,
AbsTol = 1.0E-7

I will add the ability to change it. I think, using variables in the document: RelTol and AbsTol.


I must be annoying now , but could you try please try to reduce this numbers just a bit and try my "famous" example with bioreactions. I used recently some ODE stiff solvers from a package inside R. They gave the same results with negative concentration. Then, I reduced the default values for the accuracy and it worked a bit longer, but gave me the expected zero concentration.

Regards,
Radovan



Updated. I've added support for accuracy (not completely). The library allows to set accuracy for each equation separately. Now for all the equations will be the same accuracy.

DotNumerics. ODE. Radovan.png
Russia ☭ forever, Viacheslav N. Mezentsev
#11 Objavljeno: 14. 7. 2013. 15:57:40
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: Moderator

Wrote

Wrote

Wrote

Wrote

By the way uni,

I am just curious how is the numerical accuracy controlled in all your solvers? There is no any additional parameter about this, or I was wrong about it?.

Regards,
Radovan



For all methods the following values​​:

RelTol = 1.0E-4,
AbsTol = 1.0E-7

I will add the ability to change it. I think, using variables in the document: RelTol and AbsTol.


I must be annoying now , but could you try please try to reduce this numbers just a bit and try my "famous" example with bioreactions. I used recently some ODE stiff solvers from a package inside R. They gave the same results with negative concentration. Then, I reduced the default values for the accuracy and it worked a bit longer, but gave me the expected zero concentration.

Regards,
Radovan



Updated. I've added support for accuracy (not completely). The library allows to set accuracy for each equation separately. Now for all the equations will be the same accuracy.

DotNumerics. ODE. Radovan.png



Yes ... This was simply great and a celebration for my eyes and soul .
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#12 Objavljeno: 14. 7. 2013. 19:34:48
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Amplitude detector.

Amplitude detector.png
Amplitude detector.sm (14,41 KiB) preuzeto 1768 put(ova).
Russia ☭ forever, Viacheslav N. Mezentsev
2 korisnika je svidelo ovu objavu
Radovan Omorjan 15. 7. 2013. 01:29:00, Davide Carpi 16. 7. 2013. 11:17:00
#13 Objavljeno: 16. 7. 2013. 04:26:31
Fridel Selitsky

Fridel Selitsky

520 svidjanja u 451 postova.

Grupa: User

Animation of one example of Uni


UniAnimac.sm (14,41 KiB) preuzeto 1776 put(ova).
3 korisnika je svidelo ovu objavu
Davide Carpi 16. 7. 2013. 04:35:00, Вячеслав Мезенцев 16. 7. 2013. 08:09:00, ioan92 16. 7. 2013. 16:43:00
#14 Objavljeno: 16. 7. 2013. 11:03:00
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Wrote

Hi Uni,



I've seen you can play the magician and make people's dreams to come true.

I have such a modest dream – ta have available in SMath some others modules from DOTNUMERICS, particularly the EISPACK one.

If my gentle request is not too abusive, please let me know how to address this package.


Please accept my wishes for an agreeable summer.

The same greetings for all the forum members and particularly to Andrey!



Ioan


Well, if that's possible, I'll do it. Thank you.
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
ioan92 16. 7. 2013. 17:23:00
#15 Objavljeno: 18. 7. 2013. 17:44:14
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Updated.

[+]: dn_LinAlgSolve(), dn_LinAlgLLS_COF(), dn_LinAlgLLS_QRorLQ(), dn_LinAlgLLS_SVD(), dn_LinAlgSVD(), dn_LinAlgEigenvalues(), dn_LinAlgEigenvectors(), dn_MatrixInverse().

Citat

I have such a modest dream – ta have available in SMath some others modules from DOTNUMERICS, particularly the EISPACK one.


What kind of functions do you need?

I'm not sure that dn_LinAlgEigenvalues() works correctly.
DotNumerics. Linear Algebra. Example 1.sm (28,95 KiB) preuzeto 1854 put(ova).
Russia ☭ forever, Viacheslav N. Mezentsev
2 korisnika je svidelo ovu objavu
ioan92 19. 7. 2013. 13:23:00, Radovan Omorjan 19. 7. 2013. 01:25:00
#16 Objavljeno: 19. 7. 2013. 01:40:19
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: Moderator

Hello uni,

I played a bit with your example. It seems to me that eigenvalues and eigenvectors are correct for both matrices A and F. For the matrice F you gave the vector of eigenvalues which should be correct ("must be" vector). It seems that both vectors of eigenvalues - this one and the one found by dn_LinAlgEigenvalues() correspond to the eigenvectors fond by dn_LinAlgEigenvectors(). I am not sure this should be all right then or some numerical "glitch" is involved here. For some simpler matrices it works Ok and we can get the desired result by simple transformations of eigenvectors. I do not know how the AlgLib works and which kind of transformtion uses in order to give one of the many possible solutions for eigenvectors. I might be wrong about all of this, of course.

This time again eval() must be used as well to get the result. Moreover, again the well known annoying thing that sometimes the results with and without eval() are slightly different. See the attached file please.

Regards,
Radovan
DotNumerics_LinearAlgebra_Example-corr.sm (106,57 KiB) preuzeto 1847 put(ova).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
2 korisnika je svidelo ovu objavu
Вячеслав Мезенцев 19. 7. 2013. 03:16:00, ioan92 19. 7. 2013. 13:23:00
#17 Objavljeno: 19. 7. 2013. 04:02:29
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Yes, this is interesting. And I'm doing it this way.

DotNumerics. Linear Algebra. Example 2.png
DotNumerics. Linear Algebra. Example 2.sm (11,82 KiB) preuzeto 1858 put(ova).
Russia ☭ forever, Viacheslav N. Mezentsev
2 korisnika je svidelo ovu objavu
ioan92 19. 7. 2013. 13:23:00, Radovan Omorjan 19. 7. 2013. 09:41:00
#18 Objavljeno: 19. 7. 2013. 15:17:59
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

Updated. Source code refactoring. Source code added.
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
ioan92 19. 7. 2013. 17:46:00
#19 Objavljeno: 20. 7. 2013. 01:39:05
Radovan Omorjan

Radovan Omorjan

325 svidjanja i 1 nesvidjanja u 2.052 postova.

Grupa: Moderator

Wrote

Yes, this is interesting. And I'm doing it this way.

DotNumerics. Linear Algebra. Example 2.png



Hmm...If you use eigenvals() instead of Eigenvals(), you will get the roots as on the graph. I do not know what is the difference?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#20 Objavljeno: 1. 8. 2018. 12:22:44
Вячеслав Мезенцев

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

1.558 svidjanja u 1.868 postova.

Grupa: Moderator

dn_AdamsMoulton simple test 1.

2018-08-01_20-20-59.png

dn_AdamsMoulton.test1.sm (11,33 KiB) preuzeto 1788 put(ova).
dn_AdamsMoulton.test1.pdf (48,2 KiB) preuzeto 917 put(ova).
Russia ☭ forever, Viacheslav N. Mezentsev
1 korisnika je svidelo ovu objavu
Radovan Omorjan 2. 8. 2018. 03:04:00
  • Novi postovi
  • Nema novih postova