pathsim.solvers.rk4 module

class pathsim.solvers.rk4.RK4(*solver_args, **solver_kwargs)[source]

Bases: ExplicitRungeKutta

Classical four-stage, 4th order explicit Runge-Kutta method.

The most well-known Runge-Kutta method. It provides a good balance between accuracy and computational cost for non-stiff problems. Not SSP.

Characteristics:
  • Order: 4

  • Stages: 4

  • Explicit

  • Fixed timestep only

  • Widely used, good general-purpose explicit solver.

interpolate(r, dt)[source]

Interpolate solution after successful timestep as a ratio in the interval [t, t+dt].

This is especially relevant for Runge-Kutta solvers that have a higher order interpolant. Otherwise this is just linear interpolation using the buffered state.

Parameters:
  • r (float) – ration for interpolation within timestep

  • dt (float) – integration timestep

Returns:

x – interpolated state

Return type:

numeric, array[numeric]