utils.solver.euler_method

utils.solver.euler_method(f, t_span, y0, dt, args=(), post_step=None)

Fixed-step forward Euler integrator.

Parameters

f : callable

Derivative function with signature f(t, y, *args).

t_span : tuple of float

(t0, tf) integration bounds.

y0 : array - like

Initial state vector.

dt : float

Fixed timestep.

args : tuple = ()

Extra positional arguments forwarded to f.

post_step : callable or None = None

Optional hook called after each accepted step with signature post_step(t, y) -> y. The returned array replaces the current state, allowing post-step corrections (e.g. state nudging).

Returns

solution : Solution

Object with attributes t (time axis) and y (state trajectory).

Notes

Forward Euler is first-order accurate and can be unstable for stiff systems or large dt. Prefer :func:rk4_method for most applications.