Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, the default algorithm of ode_solver is Runge-Kutta-Fehlberg 4-5, which is an adaptive step-size algorithm. The ode_solver class is wrapping routines from the GNU Scientific Library (GSL).

I recommend reading the documentation of ode_solver, there are a variety of other methods available. Here's a simple example solving a Lotka-Volterra equation:

T = ode_solver()
T.function = lambda t, y: [y[0]-y[0]*y[1], -y[1]+y[0]*y[1]]
sol_lines = Graphics()
for i in srange(0.1,1.1,.1):
    T.ode_solve(y_0=[i,i],t_span=[0,10],num_points=1000)
    y = T.solution
    sol_lines = sol_lines + line([x[1] for x in y], rgbcolor = (i,0,1-i))
show(sol_lines+point((1,1),rgbcolor=(0,0,0)), figsize = [6,6], xmax = 6, ymax = 6)