rk45(ydot=[lambda x,y: y [0]],
y0=[ 1.0] ,
x0=0.0,
x1=1.0,
nx=20)
| source code
|
-
Numerical integration of a list of ODEs using a 4th order Runge-Kutta
scheme:
h
y_{i+1} = y_i + - ( k1 + 2*k2 + 2*k3 + k4 )
6
where:
k1 = f(x_i , y_i )
k2 = f(x_i+h/2, y_i+k1*h/2)
k3 = f(x_i+h/2, y_i+k2*h/2)
k4 = f(x_i+h , y_i+k3 )
-
Application Programming Interface (API):
- Parameters:
ydot ([ lambda, lambda, ... ]) - a list of ODEs provided as ydot[k] = lambda x,y:
fun_k(x,y)
y0 ([ float, float, ... ]) - a list of starting values for y
x0 (float) - start of integration domain
x1 (float) - end of integration domain
nx (int) - number of integration steps in addition to x0
- Returns: [ list, list, ... ]
- Integration history "y" defined by [ y0, y1, ... ynx ]
|