braincell.quad module#

Numerical integrators for BrainCell.

Exposes get_integrator() plus every canonical solver name registered in braincell.quad._registry.

Note

This __init__.py deliberately performs side-effect imports of every _<backend>.py module. Each backend self-registers into the integrator registry at import time via @register_integrator. Do not lazily defer these imports — unresolved solver names would surface as ValueError: unknown integrator from get_integrator() at first call instead of at import time. The lazy-import pattern in braincell.quad._diffrax refers only to the third-party diffrax dependency, not to the backend module itself.

braincell.quad provides a mechanism to define coupled ordinary differential equations (ODEs) and solve them using various numerical integration methods. The integration methods are categorized into exponential integrators, Runge-Kutta methods, implicit methods, and Diffrax integrators.

Defining Coupled ODEs#

DiffEqState

A brainstate state that participates in numerical integration.

DiffEqModule

Mixin marking a module as integrable by braincell.quad.

IndependentIntegration

Mixin that opts a submodule out of its parent's integration loop.

Overall Integration Interface#

get_integrator(method)

Resolve a numerical integrator from a string name or a callable.

Exponential Integrators#

exp_euler_step(target, *args)

Advance one step with the (coupled) exponential Euler method.

ind_exp_euler_step(target, *args[, ...])

Advance each DiffEqState independently with exponential Euler.

Runge-Kutta Integrators#

euler_step(target, *args)

Advance one step with the explicit (forward) Euler method.

midpoint_step(target, *args)

Advance one step with the explicit midpoint (modified Euler) method.

rk2_step(target, *args)

Advance one step with a generic second-order Runge-Kutta method.

heun2_step(target, *args)

Advance one step with Heun's second-order Runge-Kutta method.

ralston2_step(target, *args)

Advance one step with Ralston's second-order Runge-Kutta method.

rk3_step(target, *args)

Advance one step with the classical third-order Runge-Kutta method.

heun3_step(target, *args)

Advance one step with Heun's third-order Runge-Kutta method.

ssprk3_step(target, *args)

Advance one step with the Strong-Stability-Preserving RK3 method.

ralston3_step(target, *args)

Advance one step with Ralston's third-order Runge-Kutta method.

rk4_step(target, *args)

Advance one step with the classical fourth-order Runge-Kutta method.

ralston4_step(target, *args)

Advance one step with Ralston's fourth-order Runge-Kutta method.

Diffrax Explicit Integrators#

diffrax_euler_step(target, *args)

Advance one step with diffrax's explicit Euler solver.

diffrax_heun_step(target, *args)

Advance one step with diffrax's Heun (improved Euler) solver.

diffrax_midpoint_step(target, *args)

Advance one step with diffrax's explicit midpoint solver.

diffrax_ralston_step(target, *args)

Advance one step with diffrax's Ralston second-order solver.

diffrax_bosh3_step(target, *args)

Advance one step with diffrax's Bogacki-Shampine 3(2) solver.

diffrax_tsit5_step(target, *args)

Advance one step with diffrax's Tsitouras 5(4) solver.

diffrax_dopri5_step(target, *args)

Advance one step with diffrax's Dormand-Prince 5(4) solver.

diffrax_dopri8_step(target, *args)

Advance one step with diffrax's Dormand-Prince 8(5,3) solver.

Diffrax Implicit Integrators#

diffrax_bwd_euler_step(target, *args[, tol])

Advance one step with diffrax's implicit (backward) Euler solver.

diffrax_kvaerno3_step(target, *args[, tol])

Advance one step with diffrax's Kvaerno 3 ESDIRK solver.

diffrax_kvaerno4_step(target, *args[, tol])

Advance one step with diffrax's Kvaerno 4 ESDIRK solver.

diffrax_kvaerno5_step(target, *args[, tol])

Advance one step with diffrax's Kvaerno 5 ESDIRK solver.