ode_solver

class cmepy.ode_solver.Solver(dy_dt, y_0, t_0=0.0, ode_config_callback=None)

Solver is a wrapper of scipy’s VODE solver.

dy_dt
Read-only property, returning the differential equations dy_dt.
set_packing(pack, unpack, transform_dy_dt=True)

Convenience routine allowing automatic change of variables.

pack : map from y variables to x variables unpack : map from x variables to y variables

x must be a one-dimensional array or scalar, while y is arbitrary

If transform_dy_dt is set to True (the default), the solver will then internally solve the IVP of (dx_dt, x_0), defined by

dx_dt(t, x) := pack(dy_dt(t, unpack(x)) x_0 := pack(y_0)

Conversely, if transform_dy_dt is set to False, dx_dt will be defined directly as dy_dt without packing / unpacking, that is,

dx_dy(t, x) := dy_dt(t, x)

Accessing the y attribute of the solver will return the current solution x transformed via unpack, that is, y = unpack(x).

step(t)

Advances the current solution to the time t.

Values of t less that the current solution time are illegal and will raise a ValueError.

If internal ODE solver errors are detected, a RuntimeError will be raised, and additional information may be displayed.

t
Read-only property, returning the current solution time t.
y
Read-only property, returning the current solution y.

Previous topic

models

Next topic

recorder

This Page