imex_cnab_step#
- class braintools.quad.imex_cnab_step(f_exp, f_imp, y, y_prev, t, *args, max_iter=2, **kwargs)#
CNAB (Crank–Nicolson / Adams–Bashforth) IMEX step (second order).
Advances using explicit AB2 for the nonstiff part and trapezoidal rule for the stiff part:
- ``y_{n+1} = y_n + dt * [ 3/2 f_exp(y_n, t_n) - 1/2 f_exp(y_{n-1}, t_{n-1}) ]
dt/2 * [ f_imp(y_{n+1}, t_{n+1}) + f_imp(y_n, t_n) ]``
- Parameters:
f_exp (
Callable[[PyTree,Array|ndarray|bool|number|bool|int|float|complex|Quantity,Any],PyTree]) – Explicit and implicit functions.f_imp (
Callable[[PyTree,Array|ndarray|bool|number|bool|int|float|complex|Quantity,Any],PyTree]) – Explicit and implicit functions.y (
PyTree) – Current state at timet.y_prev (
PyTree) – Previous state at timet - dt.t (
Array|ndarray|bool|number|bool|int|float|complex|Quantity) – Current time.*args – Extra arguments forwarded to
f_expandf_imp.max_iter (
int) – Fixed‑point iterations for the implicit corrector.
- Returns:
The updated state
y_{n+1}.- Return type:
PyTree