scipy 1.8.0 Pypi GitHub Homepage
Other Docs
AttributesNotesParametersBackRef

Attributes

t : float

Current time.

y : ndarray

Current variable values.

Solve an equation system $y'(t) = f(t,y)$ with (optional) jac = df/dy .

Note: The first two arguments of f(t, y, ...) are in the opposite order of the arguments in the system definition function used by scipy.integrate.odeint .

Notes

Available integrators are listed below. They can be selected using the :None:None:`set_integrator` method.

"vode"

Real-valued Variable-coefficient Ordinary Differential Equation solver, with fixed-leading-coefficient implementation. It provides implicit Adams method (for non-stiff problems) and a method based on backward differentiation formulas (BDF) (for stiff problems).

Source: http://www.netlib.org/ode/vode.f

warning

This integrator is not re-entrant. You cannot have two :None:None:`ode`

instances using the "vode" integrator at the same time.

This integrator accepts the following parameters in :None:None:`set_integrator` method of the ode class:

This integrator accepts the same parameters in :None:None:`set_integrator` as the "vode" solver.

note

When using ZVODE for a stiff system, it should only be used for

the case in which the function f is analytic, that is, when each f(i) is an analytic function of each y(j). Analyticity means that the partial derivative df(i)/dy(j) is a unique complex number, and this fact is critical in the way ZVODE solves the dense or banded linear systems that arise in the stiff case. For a complex stiff ODE system in which f is not analytic, ZVODE is likely to have convergence failures, and for this problem one should instead use DVODE on the equivalent real system (in the real and imaginary parts of y).

"lsoda"

Parameters

f : callable ``f(t, y, *f_args)``

Right-hand side of the differential equation. t is a scalar, y.shape == (n,) . f_args is set by calling set_f_params(*args) . f should return a scalar, array or list (not a tuple).

jac : callable ``jac(t, y, *jac_args)``, optional

Jacobian of the right-hand side, jac[i,j] = d f[i] / d y[j] . jac_args is set by calling set_jac_params(*args) .

A generic interface class to numeric integrators.

See Also

odeint

an integrator with a simpler interface based on lsoda from ODEPACK

quad

for finding the area under a curve

Examples

A problem to integrate and the corresponding jacobian:

>>> from scipy.integrate import ode
>>>
>>> y0, t0 = [1.0j, 2.0], 0
>>>
>>> def f(t, y, arg1):
...  return [1j*arg1*y[0] + y[1], -arg1*y[1]**2]
... def jac(t, y, arg1):
...  return [[1j*arg1, 1], [0, -arg1*2*y[1]]]

The integration:

>>> r = ode(f, jac).set_integrator('zvode', method='bdf')
... r.set_initial_value(y0, t0).set_f_params(2.0).set_jac_params(2.0)
... t1 = 10
... dt = 1
... while r.successful() and r.t < t1:
...  print(r.t+dt, r.integrate(r.t+dt)) 1 [-0.71038232+0.23749653j 0.40000271+0.j ] 2.0 [0.19098503-0.52359246j 0.22222356+0.j ] 3.0 [0.47153208+0.52701229j 0.15384681+0.j ] 4.0 [-0.61905937+0.30726255j 0.11764744+0.j ] 5.0 [0.02340997-0.61418799j 0.09523835+0.j ] 6.0 [0.58643071+0.339819j 0.08000018+0.j ] 7.0 [-0.52070105+0.44525141j 0.06896565+0.j ] 8.0 [-0.15986733-0.61234476j 0.06060616+0.j ] 9.0 [0.64850462+0.15048982j 0.05405414+0.j ] 10.0 [-0.38404699+0.56382299j 0.04878055+0.j ]
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.integrate._quadrature.simpson scipy.integrate._ode.complex_ode scipy.integrate._quadpack_py.dblquad scipy.integrate._odepack_py.odeint scipy.integrate._quadrature.quadrature scipy.integrate._quadrature.romb scipy.integrate._quadrature.romberg scipy.integrate._quadrature.fixed_quad scipy.integrate._quadrature.cumulative_trapezoid scipy.integrate._quadpack_py.quad scipy.integrate._ode.ode scipy.integrate._quadpack_py.tplquad

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/integrate/_ode.py#105
type: <class 'type'>
Commit: