solver

Tools for solving compartmental ODEs

class summer.solver.SolverType

Bases: object

Options for ODE solver used by model

EULER = 'euler'
ODE_INT = 'odeint'
RUNGE_KUTTA = 'rk4'
SOLVE_IVP = 'solve_ivp'
STOCHASTIC = 'stochastic'
summer.solver.solve_ode(solver_type: str, ode_func: Callable[[numpy.ndarray, float], numpy.ndarray], values: numpy.ndarray, times: numpy.ndarray, solver_args: dict)numpy.ndarray

Solve an ODE function given a function describing the dynamics, some initial conditions and times.

summer.solver.solve_with_euler(ode_func: Callable[[numpy.ndarray, float], numpy.ndarray], values: numpy.ndarray, times: numpy.ndarray, solver_args: dict)

Solve ODE with a hand-rolled Euler’s method implementation.

WARNING: This method is too inaccurate to use for real applications.

summer.solver.solve_with_ivp(ode_func: Callable[[numpy.ndarray, float], numpy.ndarray], values: numpy.ndarray, times: numpy.ndarray, solver_args: dict)

Solve ODE with SciPy’s solve_ivp solver. This method allows us to set a stopping condition.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html

summer.solver.solve_with_odeint(ode_func: Callable[[numpy.ndarray, float], numpy.ndarray], values: numpy.ndarray, times: numpy.ndarray, solver_args: dict)

Solve ODE with SciPy’s odeint solver.

https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.odeint.html

summer.solver.solve_with_rk4(ode_func: Callable[[numpy.ndarray, float], numpy.ndarray], values: numpy.ndarray, times: numpy.ndarray, solver_args: dict)

Solve ODE with a hand-rolled Runge-Kutta 4 implementation.

WARNING: This method may require a very small time step to perform accurate numerical integration.