# Incorrect integration of SDEs without non-stochastic term #686

Closed
opened this Issue Apr 26, 2016 · 2 comments

Projects
None yet
2 participants
Member

### mstimberg commented Apr 26, 2016

 @romainbrette found a quite severe bug in the integration of stochastic equations, which turned out to be a regression (i.e. it worked correctly in 2.0b4). It might be worth doing a 2.0rc2 release that includes the fix. In current master: In [2]: eqs = Equations('dx/dt = xi/sqrt(ms) : 1') In [3]: print(euler(eqs)) xi = dt**.5 * randn() _x = 1.0*xi/sqrt(ms) x = _x Note how x is set to a new value every time step. The same code in 2.0b4 gives the correct result: In [2]: eqs = Equations('dx/dt = xi/sqrt(ms) : 1') In [3]: print(euler(eqs)) xi = dt**.5 * randn() _x = x + 1.0*xi/sqrt(ms) x = _x The problem was introduced in commit adafd63, I'll have a look into this.

Member

### mstimberg commented Apr 26, 2016

 Just to make sure there is no misunderstanding: this does not affect more standard uses of noise in equations (like dx/dt = - x / tau + tau**-.5 * xi : 1). As the title says, the problem only occurs for equations dx/dt = f(x) + g(x)*xi with no f(x) term (an ugly workaround is therefore to add something like + 1e-15*x to the equations).
Member

### thesamovar commented Apr 26, 2016

 That's a really weird bug! Yeah, happy to do rc2 to fix this.

Merged