New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect integration of SDEs without non-stochastic term #686

Closed
mstimberg opened this Issue Apr 26, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@mstimberg
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.

@mstimberg

This comment has been minimized.

Show comment
Hide comment
@mstimberg

mstimberg Apr 26, 2016

Member

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

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).

@thesamovar

This comment has been minimized.

Show comment
Hide comment
@thesamovar

thesamovar Apr 26, 2016

Member

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

Member

thesamovar commented Apr 26, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment