Differential Equations

Differential Equations#

In braincell, we often need to define time-varying states, such as membrane potential, gating variables, and concentrations. The evolution of these states is usually determined by differential equations.

To uniformly describe these dynamic states, braincell provides two very important foundational components:

  • DiffEqState: used to define dynamic state variables with derivatives and diffusion terms.

  • DiffEqModule: used to construct the core interfaces required to implement differential equations.

With DiffEqState and DiffEqModule, we can express various differential equation systems in a clear and modular way, converting electrophysiological mechanisms into numerically computable model structures, which are key tools for building neural dynamic models.

Below, we introduce the purposes and usage of these two modules.

DiffEqState#

DiffEqState is a general implementation for all state variables that evolve based on differential equations, inheriting from brainstate.ShortTermState.

You can update its derivatives and diffusion terms in the differential equation module, and the framework will automatically handle integration and related steps.

DiffEqModule#

DiffEqModule is a mixin class that provides modules with a differential equation modeling interface.