As withintegration, SciPy has some extremely accurate general-purpose solvers for systems of ordinary differential equations of the first order:
For real-valued functions, we have basically two flavors:ode(with options passed with theset_integratormethod) andodeint(simpler interface). The syntax ofodeis as follows:
ode(f,jac=None)
The first parameter,f, is the function to be integrated, and the second parameter,jac, refers to the matrix of partial derivatives with respect to the dependent variables (the Jacobian). This creates anodeobject with different methods to indicate the algorithm to solve the system (set_integrator), the initial conditions (set_initial_value), and different parameters to be sent to the function or its Jacobian.
The options for the integration algorithm are vode for the real-valued variable coefficient ODE solver, with fixed-leading-coefficient implementation (it provides Adam's method for non-stiff problems and BDF for stiff); zvode for the complex-valued variable coefficient ODEsolver, with similar options to the preceding option; dopri5 for aRunge-Kuttamethod of order (4)5; dop853 for a Runge-Kutta method of order 8(5, 3).
The next codesnippet presents an example of usingscipy.integrate.odeto solve the initial value problem using the following formula: