Skip to main content

Module ivp

Module ivp 

Source
Expand description

Initial value problems y' = f(t, y) with dense output and event location, following scipy.integrate.solve_ivp:

  • IvpMethod::Radau: the implicit Runge-Kutta method Radau IIA of order 5 (Hairer and Wanner), L-stable, with a cubic collocation polynomial as dense output. A step-for-step port of SciPy’s Radau.
  • IvpMethod::Lsoda: variable-order, variable-step multistep methods in Nordsieck form that switch automatically between Adams-Moulton (orders 1 to 12, functional iteration) for non-stiff stretches and BDF (orders 1 to 5, Newton iteration) for stiff ones, after Petzold’s LSODA. The method coefficients are those of Hindmarsh’s ODEPACK.

Every accepted step contributes a polynomial piece to a DenseOutput, so the solution can be evaluated anywhere, and Event functions g(t, y) are located to machine precision on it by Brent’s method.

See the book entry Radau, LSODA and event location.

Structs§

DenseOutput
The continuous solution: one polynomial piece per accepted step.
Event
An event function g(t, y) whose zeros are located during the integration.
ExplicitOptions
Tolerances and limits for solve_ivp_explicit. Each step keeps the local error of component i below atolᵢ + rtol · |yᵢ| in the RMS norm, where atolᵢ comes from atol_components if it is non-empty (one entry per component) and from atol otherwise.
IvpOptions
Tolerances and limits for solve_ivp. Each step keeps the local error of every component below atol + rtol · |yᵢ|, measured in the root-mean-square norm as in SciPy.
IvpSolution
The result of solve_ivp.
Segment
One polynomial piece of the dense output: y(t) = y_ref + Σₖ cₖ sᵏ⁺¹ with s = (t − t_ref) / h, valid on [t_start, t_end].

Enums§

ExplicitMethod
The explicit method of solve_ivp_explicit. New methods may be added in minor releases.
IvpMethod
The method of solve_ivp.
IvpStatus
Why the integration stopped.
SparseJacobian
A sparse Jacobian for solve_ivp_sparse: a function returning ∂f/∂y as a sparse matrix, or the sparsity pattern of ∂f/∂y for grouped finite differences (SciPy’s jac_sparsity).

Functions§

solve_ivp
Solves y' = f(t, y), y(t0) = y0 on [t0, t1] (t1 > t0) with the given method (SciPy’s solve_ivp), returning every accepted step, the dense output, and the occurrences of each event. jac, if given, returns ∂f/∂y as rows; otherwise forward differences are used.
solve_ivp_explicit
Solves y' = f(t, y), y(t0) = y0 from t0 to t1 with an explicit Runge-Kutta method (SciPy’s solve_ivp with method='RK45' or 'DOP853'). t1 < t0 integrates backwards. Returns the same IvpSolution as solve_ivp: every accepted step, a dense output, and the occurrences of each Event located on the interpolants.
solve_ivp_sparse
solve_ivp for large stiff systems with sparse Jacobians (SciPy’s solve_ivp with a sparse jac or with jac_sparsity). The Newton matrices of Radau (μ/h · I − J, real and complex) and of LSODA’s BDF corrector (I − h l₀ J) are factorised by the sparse LU (SparseLu, minimum-degree ordering); Radau’s complex system is solved in its real form of twice the size. With SparseJacobian::Pattern, the Jacobian is estimated by grouped forward differences: columns sharing no row are perturbed together (Curtis, Powell and Reid), so a banded n × n Jacobian costs a few evaluations of f instead of n.

Type Aliases§

EventFunction
The boxed function of an Event.
SparseJacobianFn
Counts evaluations of f and its Jacobian. A boxed function returning a sparse Jacobian.