# ODE¶

class probnum.diffeq.ODE(timespan, rhs, jac=None, hess=None, sol=None)

Bases: abc.ABC

Ordinary differential equations.

Extended by the types of ODEs, e.g. IVPs, BVPs. This class describes systems of irst order ordinary differential equations (ODEs),

$\dot y(t) = f(t, y(t)), \quad t \in [t_0, T].$

It provides options for defining custom right-hand side (RHS) functions, their Jacobians and closed form solutions.

Parameters: timespan ((float, float)) – Time span of IVP. rhs (callable, signature: (t, y, **kwargs)) – RHS function $$f : [t_0, T] imes \mathbb{R}^d \rightarrow \mathbb{R}^d$$ of the ODE system. As such it takes a float and an np.ndarray of shape (d,) and returns a np.ndarray of shape (d,). As of now, no vectorization is supported (nor needed). jac (callable, signature: (t, y, **kwargs), optional) – Jacobian of RHS function $$J_f : [0, T] \times \mathbb{R}^d \rightarrow \mathbb{R}^d$$ of the ODE system. As such it takes a float and an np.ndarray of shape (d,) and returns a np.ndarray of shape (d,). As of now, no vectorization is supported (nor needed). sol (callable, signature: (t, **kwargs), optional) – Solution of the ODE system. Only well-defined in subclasses like IVP or BVP.

See also

IVP
Extends ODE for initial value problems.

Attributes Summary

 ndim Abstract, in order to force subclassing. t0 timespan Returns $$(t_0, T)$$ as [self.t0, self.tmax]. tmax

Methods Summary

 __call__(t, y, **kwargs) Piggybacks on self.rhs(t, y). hessian(t, y, **kwargs) Hessian of model function f. jacobian(t, y, **kwargs) Jacobian of model function f. rhs(t, y, **kwargs) Evaluates model function f. solution(t, **kwargs) Solution of the IVP.

Attributes Documentation

ndim

Abstract, in order to force subclassing.

t0
timespan

Returns $$(t_0, T)$$ as [self.t0, self.tmax]. Mainly here to provide an interface to scipy.integrate. Both $$t_0$$ and $$T$$ can be accessed via self.t0 and self.tmax respectively.

tmax

Methods Documentation

__call__(t, y, **kwargs)[source]

Piggybacks on self.rhs(t, y).

hessian(t, y, **kwargs)[source]

Hessian of model function f.

For $$d=3$$, the Hessian $$H_f(t, y) \in \mathbb{R}^{3 \times 3 \times 3}$$ is expected be evaluated as

$H_f(t, y) = \left[H_{f_1}(t, y), H_{f_2}(t, y), H_{f_3}(t, y) \right]^\top$

since for any directions $$v_1, v_2$$ the outcome of $$H_f(t_0, y_0) \cdot v_1 \cdot v_2$$ is expected to contain the incline of $$f_i$$ in direction $$(v_1, v_2)$$.

jacobian(t, y, **kwargs)[source]

Jacobian of model function f.

rhs(t, y, **kwargs)[source]

Evaluates model function f.

solution(t, **kwargs)[source]

Solution of the IVP.