mattja / sdeint

Numerical integration of Ito or Stratonovich SDEs
GNU General Public License v3.0
155 stars 25 forks source link

Problem with 2D ITO integration #16

Closed Peter230655 closed 3 years ago

Peter230655 commented 3 years ago

I tried your 1D example given in the introduction, and it seemed to work fine. Then I tried the 2D example, and it did not seem to work: No matter what I entered, the graphs of both solutions dropped from the starting point straight to zero and remained there.

where is my mistake? Thanks for any help!

mattja commented 3 years ago

I just checked the 2D example and it works perfectly. The solution spirals around the origin as expected:

from matplotlib import pyplot as plt
plt.plot(result[:,0], result[:,1], '-')
plt.show()

output

Are you using a current version of sdeint?

Peter230655 commented 3 years ago

Thanks a lot! I probably installed an old version or I installed it improperly. I will install it again. (I can use Python on iPad only, using the JUNO app. This does not allow to install SDEINT directly, so I had to do it manually, maybe I did it wrong.)

Am Di., 3. Aug. 2021 um 03:55 Uhr schrieb Matthew Aburn < @.***>:

I just checked the 2D example and it works perfectly. The solution spirals around the origin as expected:

from matplotlib import pyplot as plt plt.plot(result[:,0], result[:,1], '-') plt.show()

[image: output] https://user-images.githubusercontent.com/7663625/127943984-b9488e9c-7185-482e-b272-b513e5f998c4.png

Are you using a current version of sdeint?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattja/sdeint/issues/16#issuecomment-891449946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT5MQUX6CBU4L7HO4PR2ZG3T25EBNANCNFSM5BNDNUPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

Peter230655 commented 3 years ago

Just for information: I tried a relatively larger problem with your SDEINT: I used sympy.physics.mechanics for the equations of motion, which I then linearized around F_i = 0 to get your formalism. f and G (as you call them in your examples) each have around 45,000 ‚operations‘, as counted by sympy.count_ops().

It worked without any problems, and the results looked like one would expect them to look.

On Tue 3. Aug 2021 at 03:55 Matthew Aburn @.***> wrote:

I just checked the 2D example and it works perfectly. The solution spirals around the origin as expected:

from matplotlib import pyplot as plt plt.plot(result[:,0], result[:,1], '-') plt.show()

[image: output] https://user-images.githubusercontent.com/7663625/127943984-b9488e9c-7185-482e-b272-b513e5f998c4.png

Are you using a current version of sdeint?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattja/sdeint/issues/16#issuecomment-891449946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT5MQUX6CBU4L7HO4PR2ZG3T25EBNANCNFSM5BNDNUPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

-- Best regards,

Peter Stahlecker

Peter230655 commented 2 years ago

Hi, I use your sdeint quite often, just to play around integrating equations of motion set up using sympy physics mechanics. It works fine!

One question: I believe your integration routine itoint does not ‚adjust‘ the integration step size, like e.g. odeint seems to do. In your opinion, what is a good number of steps per time unit. I got the feeling around 5000 steps / time unit is good, but you surely know better.

Thanks and take care!

Peter

On Tue 10. Aug 2021 at 16:37 Peter Stahlecker @.***> wrote:

Just for information: I tried a relatively larger problem with your SDEINT: I used sympy.physics.mechanics for the equations of motion, which I then linearized around F_i = 0 to get your formalism. f and G (as you call them in your examples) each have around 45,000 ‚operations‘, as counted by sympy.count_ops().

It worked without any problems, and the results looked like one would expect them to look.

On Tue 3. Aug 2021 at 03:55 Matthew Aburn @.***> wrote:

I just checked the 2D example and it works perfectly. The solution spirals around the origin as expected:

from matplotlib import pyplot as plt plt.plot(result[:,0], result[:,1], '-') plt.show()

[image: output] https://user-images.githubusercontent.com/7663625/127943984-b9488e9c-7185-482e-b272-b513e5f998c4.png

Are you using a current version of sdeint?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mattja/sdeint/issues/16#issuecomment-891449946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT5MQUX6CBU4L7HO4PR2ZG3T25EBNANCNFSM5BNDNUPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

-- Best regards,

Peter Stahlecker

-- Best regards,

Peter Stahlecker