forked from hplgit/odespy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.do.txt
84 lines (61 loc) · 3.32 KB
/
README.do.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
===== What is Odespy? =====
Odespy (ODE Software in Python) offers a unified interface to a
a large collection of software for solving systems of ordinary
differential equations (ODEs). There is also some support for
Differential Algebraic Equations (DAEs).
===== Contents of Odespy =====
Odespy features the following collection of numerical methods and
implementations:
* Pure Python implementations of classical explicit schemes such as
the Forward Euler method (also called Euler);
Runge-Kutta methods of 2nd, 3rd, and 4th order; Heun's method;
Adams-Bashforth methods of 2nd, 3rd, and 4th order;
Adams-Bashforth-Moulton methods of 2nd and 3rd order.
* Pure Python implementations of classical implicit schemes such as
Backward Euler; 2-step backward scheme; the theta rule;
the Midpoint (or Trapezoidal) method.
* Pure Python implementations of adaptive explicit Runge-Kutta
methods of type Runge-Kutta-Fehlberg of order (4,5), Dormand-Prince
of order (4,5), Cash-Karp of order (4,5), Bogacki-Shampine of order (2,3).
* Wrappers for all FORTRAN solvers in "`ODEPACK`": "http://www.netlib.org/odepack".
* Wrappers for the wrappers of FORTRAN solvers in "`scipy`": "http://www.scipy.org":
`vode` and `zvode` (adaptive Adams or BDF from "`vode.f`": "http://www.netlib.org/ode/vode.f");
`dopri5` (adaptive Dormand-Prince method of order (4,5));
`dop853` (adaptive Dormand-Prince method of order 8(5,3));
`odeint` (adaptive Adams or BDF, basically the same as `vode`, but in the implementation `lsoda` from "`ODEPACK`": "http://www.netlib.org/odepack/").
* Wrapper for the Runge-Kutta-Chebyshev formulas of order 2 as
offered by the well-known FORTRAN code "`rkc.f`": "http://www.netlib.org/ode/rkc.f".
* Wrapper for the Runge-Kutta-Fehlberg method of
order (4,5) as provided by the well-known FORTRAN code "`rkf45.f`": "http://www.netlib.org/ode/rkf45.f".
* Wrapper for the Radau5 method as provided by the well-known FORTRAN code
"`radau5.f`": "http://www.unige.ch/~hairer/prog/stiff/radau5.f".
There has been some problems with running this solver (segmentation fault).
* Wrapper for some solvers in the "`odelab`": "https://github.com/olivierverdier/odelab".
The ODE problem can always be specified in Python, but for wrappers of
FORTRAN codes one can also implement the problem in FORTRAN and avoid
callback to Python.
===== How do I use Odespy? =====
Here is an example on the Odespy syntax::
def f(u, t):
"""2x2 system for a van der Pool oscillator."""
return [u[1], 3.*(1. - u[0]*u[0])*u[1] - u[0]]
import odespy, numpy
solver = odespy.Vode(f, rtol=0.0, atol=1e-6,
adams_or_bdf='adams', order=10)
solver.set_initial_condition([2.0, 0.0])
t_points = numpy.linspace(0, 30, 150)
u, t = solver.solve(t_points)
u0 = u[:,0]
from matplotlib.pyplot import *
plot(t, u0)
show()
An incomplete "tutorial":
"http://hplgit.github.io/odespy/doc/tutorial/html/index.html" is under
development and explains much more of the syntax and provides many
examples.
===== I have used Odespy in a publication - how to I site it? =====
Please cite this GitHub repository:
!bc
H. P. Langtangen and L. Wang. The Odespy package.
URL: https://github.com/hplgit/odespy. 2013
!ec