Hi. As soon as you add noise to your equations, the equation becomes a stochastic differential equation (SDE) and the numerical integration method has to take care of this. The Euler method has built-in support for this type of randomness, and the “milstein” and “heun” methods support even more complex noise terms. The exponential Euler method does not support it at the moment (same for RK2, RK4, …), even though I think there are extensions of this method to SDEs.
To solve this issue with the current version of Brian, you have two options:
- Use a solver like “milstein” or “heun” that can deal with the noise term – but note that they might have numerical stability issues with the HH equations.
- Calculate an approximation of the noise yourself instead of including the “ideal noise” term in the equations.
For 2, you can use the approximation that is used by the Euler algorithm, i.e. an appropriately scaled normal random number that is constant over the time step. To do this in your equations, replace
noise, and add the following definition to your equations:
noise = sigma*xi*(2*gl/Cm)**.5*randn()/sqrt(dt) : 1/second (constant over dt)