braincell.quad.implicit_euler_step

braincell.quad.implicit_euler_step#

braincell.quad.implicit_euler_step(target, t, dt, *args)[source]#

Advance one step with the implicit (backward) Euler method.

Solves

\[y_{n+1} = y_n + \Delta t \, f(t_{n+1}, y_{n+1})\]

by Newton iteration on the residual \(g(y) = y - y_n - \Delta t \, f(t + \Delta t, y)\). Each

iteration assembles the full Jacobian \(J = \partial g / \partial y\) and updates \(y \leftarrow y - J^{-1} g(y)\) until either the residual norm or

the Jacobian norm falls below 1e-5 or 100 iterations have been spent.

Implicit Euler is \(L\)-stable, so it tolerates arbitrarily large time steps on stiff problems at the cost of damping high-frequency components. Local truncation error is \(O(\Delta t^2)\); global error is \(O(\Delta t)\).

Parameters:
  • target (DiffEqModule) – The module whose DiffEqState leaves are advanced.

  • t (Quantity[s]) – Current simulation time.

  • dt (Quantity[s]) – Time step. Must carry units of time (e.g. 0.025 * u.ms).

  • *args – Extra positional arguments forwarded to target’s compute_derivative and pre/post_integral hooks.

Returns:

target’s differential states are updated in place.

Return type:

None

See also

backward_euler_step

Single-Jacobian linearized backward Euler (one Newton iteration).

splitting_step

Backward Euler for the cable equation paired with a Newton solve for the gating variables.

cn_exp_euler_step

Crank-Nicolson cable solve combined with exponential Euler gating.