DotNumerics

DotNumerics - Initial-value problem for nonstiff and stiff ordinary differential equations ODEs - Сообщения

#1 Опубликовано: 13.07.2013 03:50:08
Вячеслав Мезенцев

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

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

Группа: Moderator

DotNumerics

SMath Studio compatibility SMath Viewer compatibility mono compatibility Extension page Sources


Functions list:

Показать спойлер



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.

[albumimg]237[/albumimg]

Examples:

[albumimg]232[/albumimg] [albumimg]241[/albumimg] [albumimg]242[/albumimg] [albumimg]243[/albumimg]

[albumimg]1564[/albumimg] [albumimg]1579[/albumimg] [albumimg]1580[/albumimg] [albumimg]1567[/albumimg] [albumimg]1566[/albumimg] [albumimg]1565[/albumimg]

dn.ode.kinetic1.sm (8 КиБ) скачан 151 раз(а).
dn.ode.kinetic2.sm (12 КиБ) скачан 116 раз(а).
dn.ode.kinetic3.sm (12 КиБ) скачан 120 раз(а).
dn.ode.test1.sm (19 КиБ) скачан 134 раз(а).
dn.ode.test2.sm (18 КиБ) скачан 122 раз(а).
dn.ode.Amplitude detector.sm (20 КиБ) скачан 134 раз(а).

dn.ode.kinetic1.pdf (77 КиБ) скачан 135 раз(а).
dn.ode.kinetic2.pdf (93 КиБ) скачан 117 раз(а).
dn.ode.kinetic3.pdf (91 КиБ) скачан 114 раз(а).
dn.ode.test1.pdf (115 КиБ) скачан 114 раз(а).
dn.ode.test2.pdf (120 КиБ) скачан 109 раз(а).
dn.ode.Amplitude detector.pdf (148 КиБ) скачан 115 раз(а).

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 КиБ) скачан 161 раз(а).
Russia ☭ forever, Viacheslav N. Mezentsev
4 пользователям понравился этот пост
Davide Carpi 14.07.2013 09:00:00, ioan92 13.07.2013 06:54:00, Radovan Omorjan 13.07.2013 07:01:00, IVR 13.07.2013 05:01:00
#2 Опубликовано: 14.07.2013 03:15:34
Вячеслав Мезенцев

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

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

Группа: 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 пользователям понравился этот пост
Radovan Omorjan 14.07.2013 05:28:00
#3 Опубликовано: 14.07.2013 05:41:33
Radovan Omorjan

Radovan Omorjan

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

Группа: 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 пользователям понравился этот пост
#4 Опубликовано: 14.07.2013 08:55:08
Вячеслав Мезенцев

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

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

Группа: 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 Опубликовано: 14.07.2013 08:56:35
Radovan Omorjan

Radovan Omorjan

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

Группа: 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 Опубликовано: 14.07.2013 08:59:20
Davide Carpi

Davide Carpi

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

Группа: 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 Опубликовано: 14.07.2013 09:04:02
Вячеслав Мезенцев

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

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

Группа: 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 пользователям понравился этот пост
Radovan Omorjan 14.07.2013 09:09:00
#8 Опубликовано: 14.07.2013 09:08:34
Radovan Omorjan

Radovan Omorjan

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

Группа: 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 пользователям понравился этот пост
Davide Carpi 14.07.2013 09:29:00
#9 Опубликовано: 14.07.2013 09:30:28
Radovan Omorjan

Radovan Omorjan

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

Группа: 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 Опубликовано: 14.07.2013 14:52:57
Вячеслав Мезенцев

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

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

Группа: 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.

[albumimg]245[/albumimg]
Russia ☭ forever, Viacheslav N. Mezentsev
#11 Опубликовано: 14.07.2013 15:57:40
Radovan Omorjan

Radovan Omorjan

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

Группа: 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.

[albumimg]245[/albumimg]



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 Опубликовано: 14.07.2013 19:34:48
Вячеслав Мезенцев

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

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

Группа: Moderator

Amplitude detector.

[albumimg]246[/albumimg]
Amplitude detector.sm (14 КиБ) скачан 106 раз(а).
Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
Radovan Omorjan 15.07.2013 01:29:00, Davide Carpi 16.07.2013 11:17:00
#13 Опубликовано: 16.07.2013 04:26:31
Fridel Selitsky

Fridel Selitsky

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

Группа: User

Animation of one example of Uni


UniAnimac.sm (14 КиБ) скачан 121 раз(а).
3 пользователям понравился этот пост
Davide Carpi 16.07.2013 04:35:00, Вячеслав Мезенцев 16.07.2013 08:09:00, ioan92 16.07.2013 16:43:00
#14 Опубликовано: 16.07.2013 11:03:00
Вячеслав Мезенцев

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

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

Группа: 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 пользователям понравился этот пост
ioan92 16.07.2013 17:23:00
#15 Опубликовано: 18.07.2013 17:44:14
Вячеслав Мезенцев

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

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

Группа: Moderator

Updated.

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

Цитата

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 КиБ) скачан 144 раз(а).
Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
ioan92 19.07.2013 13:23:00, Radovan Omorjan 19.07.2013 01:25:00
#16 Опубликовано: 19.07.2013 01:40:19
Radovan Omorjan

Radovan Omorjan

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

Группа: 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 КиБ) скачан 118 раз(а).
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
2 пользователям понравился этот пост
Вячеслав Мезенцев 19.07.2013 03:16:00, ioan92 19.07.2013 13:23:00
#17 Опубликовано: 19.07.2013 04:02:29
Вячеслав Мезенцев

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

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

Группа: Moderator

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

[albumimg]250[/albumimg]
DotNumerics. Linear Algebra. Example 2.sm (11 КиБ) скачан 145 раз(а).
Russia ☭ forever, Viacheslav N. Mezentsev
2 пользователям понравился этот пост
ioan92 19.07.2013 13:23:00, Radovan Omorjan 19.07.2013 09:41:00
#18 Опубликовано: 19.07.2013 15:17:59
Вячеслав Мезенцев

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

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

Группа: Moderator

Updated. Source code refactoring. Source code added.
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
ioan92 19.07.2013 17:46:00
#19 Опубликовано: 20.07.2013 01:39:05
Radovan Omorjan

Radovan Omorjan

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

Группа: Moderator

Wrote

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

[albumimg]250[/albumimg]



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 Опубликовано: 01.08.2018 12:22:44
Вячеслав Мезенцев

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

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

Группа: Moderator

dn_AdamsMoulton simple test 1.

[albumimg]1498[/albumimg]

dn_AdamsMoulton.test1.sm (11 КиБ) скачан 108 раз(а).
dn_AdamsMoulton.test1.pdf (48 КиБ) скачан 98 раз(а).
Russia ☭ forever, Viacheslav N. Mezentsev
1 пользователям понравился этот пост
Radovan Omorjan 02.08.2018 03:04:00
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений