VanDerPolStep#
- class brainmass.VanDerPolStep(in_size, mu=1.0, noise_x=None, noise_y=None, init_x=Uniform(low=0, high=0.05), init_y=Uniform(low=0, high=0.05), method='exp_euler')#
Van der Pol oscillator (two-dimensional form).
In the study of dynamical systems, the van der Pol oscillator (named for Dutch physicist Balthasar van der Pol) is a non-conservative, oscillating system with non-linear damping. It evolves in time according to the second-order differential equation
\[ {d^{2}x \over dt^{2}}-\mu (1-x^{2}){dx \over dt}+x=0 \]where \(x\) is the position coordinate—which is a function of the time \(t\)— and \(\mu\) is a scalar parameter indicating the nonlinearity and the strength of the damping.
Implements the Van der Pol oscillator using the Liénard transformation that yields the planar system
\[\dot x = \mu\,\left(x - \tfrac{1}{3}x^3 - y\right) + I_x(t),\]\[\dot y = \frac{1}{\mu}\,x + I_y(t),\]where \(x\) is the state (often interpreted as position or activation), \(y\) is the auxiliary variable, and \(\mu > 0\) controls the nonlinearity and damping. The model exhibits a stable limit cycle for any \(\mu > 0\).
Another commonly used form based on the transformation \(y={\dot {x}}\) leads to:
\[ {\dot {x}}=y \]\[ {\dot {y}}=\mu (1-x^{2})y-x \]- Parameters:
in_size (
int|Sequence[int] |integer|Sequence[integer]) – Spatial shape of the node/population. Can be anintor a tuple ofint. All parameters are broadcastable to this shape.mu (
Callable|Array|ndarray|bool|number|bool|int|float|complex|Quantity|Param) – Nonlinearity/damping parameter (dimensionless). Default is1.0.noise_x (
Noise) – Additive noise process for the \(x\)-equation. If provided, called each update and added tox_inp. Default isNone.noise_y (
Noise) – Additive noise process for the \(y\)-equation. If provided, called each update and added toy_inp. Default isNone.init_x (
Callable) – Parameter for the statex. Default isbraintools.init.Uniform(0, 0.05).init_y (
Callable) – Parameter for the statey. Default isbraintools.init.Uniform(0, 0.05).method (
str) – Time stepping method. One of'exp_euler'(exponential Euler; default) or any method supported underbraintools.quad(e.g.,'rk4','midpoint','heun','euler').
- Return type:
Any
- x#
State container for \(x\) (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
- y#
State container for \(y\) (dimensionless). Shape equals
(batch?,) + in_sizeafterinit_state.- Type:
brainstate.HiddenState
Notes
Time derivatives returned by
dx()anddy()carry unit1/msso that a step sizedtwith unitmsis consistent.For
method='exp_euler'the update usesbrainstate.nn.exp_euler_step. Otherwise, it dispatches to the corresponding routine inbraintools.quad.
References
van der Pol, B. (1926). On “relaxation-oscillations”. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 2(11), 978–992.
Kaplan, D., & Glass, L. (1995). Understanding Nonlinear Dynamics. Springer (pp. 240–244).
- derivative(state, t, x_inp, y_inp)[source]#
Vector field for ODE integrators.
This packs
dx()anddy()into a single callable of the formf(state, t, x_inp, y_inp)to be used bybraintools.quadintegrators whenmethod != 'exp_euler'.- Parameters:
- Returns:
Derivatives as
(dx/dt, dy/dt)each with unit1/ms.- Return type:
tuple of array-like
- dx(x, y, inp)[source]#
Right-hand side for the state
x.- Parameters:
x (array-like) – Current value of
x(dimensionless).y (array-like) – Current value of
y(dimensionless), broadcastable tox.inp (array-like or scalar) – External input to
x(includes noise if enabled).
- Returns:
Time derivative
dx/dtwith unit1/ms.- Return type:
array-like
- dy(y, x, inp=0.0)[source]#
Right-hand side for the state
y.- Parameters:
y (array-like) – Current value of
y(dimensionless).x (array-like) – Current value of
x(dimensionless), broadcastable toy.inp (array-like or scalar, optional) – External input to
y(includes noise if enabled). Default is0..
- Returns:
Time derivative
dy/dtwith unit1/ms.- Return type:
array-like