InitialValueProblem

class probnum.problems.InitialValueProblem(f, t0, tmax, y0, df=None, ddf=None, solution=None)

Bases: object

First order ODE initial value problem.

Compute a function \(y=y(t)\) that solves

\[\dot y(t) = f(t, y(t)), \quad y(t_0) = y_0\]

on time-interval \([t_0, t_\text{max}]\). Solved by probabilistic ODE solvers in probnum.diffeq.

Parameters
  • f (Callable[[float, np.ndarray], np.ndarray]) – ODE vector-field.

  • t0 (float) – Initial point in time.

  • tmax (float) – Final point in time.

  • y0 (Union[FloatLike, np.ndarray]) – Initial value of the solution.

  • df (Optional[Callable[[float, np.ndarray], np.ndarray]]) – Jacobian of the ODE vector-field \(f=f(t,y)\) with respect to the \(y\) variable.

  • ddf (Optional[Callable[[float, np.ndarray], np.ndarray]]) – Hessian of the ODE vector-field \(f=f(t,y)\) with respect to the \(y\) variable.

  • solution (Optional[Callable[[float, np.ndarray], np.ndarray]]) – Closed form, analytic solution to the problem. Used for testing and benchmarking.

  • dy0_all – All initial derivatives up to some order.

Return type

None

Examples

>>> import numpy as np
>>> def f(t, x):
...     return x*(1-x)
>>> ivp = InitialValueProblem(f, t0=0., tmax=3., y0=0.1)
>>> ivp.t0, ivp.tmax, ivp.y0
(0.0, 3.0, 0.1)
>>> np.round(ivp.f(ivp.t0, ivp.y0), 2)
0.09

Attributes Summary

ddf

df

dimension

solution

Attributes Documentation

ddf: Optional[Callable[[float, np.ndarray], np.ndarray]] = None
df: Optional[Callable[[float, np.ndarray], np.ndarray]] = None
dimension
solution: Optional[Callable[[float, np.ndarray], np.ndarray]] = None