# Re: [DS] Solving stochastic differential equations

3 views

### Bolun Chen

Apr 28, 2020, 3:18:55 PM4/28/20
to Dyn...@groupspaces.com
Hello all,

I guess somebody must have covered this topic before, but I have a question about how Dynasim handles with additive noise in ODEs.

In the example of Izhikevich model, the input current has a fluctuating component,

'I(t) = Iapp*(t>ton & t<toff).*(1+0.5*rand(1,Npop))'

If I choose the solver as ‘euler', then in the generated solve_ode.m file, it updates variables using the regular Euler’s method:

pop1_v(n)=pop1_v(n-1)+dt*pop1_v_k1;
pop1_u(n)=pop1_u(n-1)+dt*pop1_u_k1;

where pop1_v_k1 and pop1_u_k1 are the r.h.s of ODEs.

But since the current is an additive noise term, shouldn’t we use the Euler-Mayamara method:

pop1_v(n)=pop1_v(n-1)+dt*deterministic_part + sqrt(dt)*sigma*randn() ?

It seems other solvers (rk2,rk4,all Matlab ode solvers) are doing the regular dt-update, which is designed for ODEs. But is there any solver that can deal with SDEs instead? Or did I miss something here?

Thanks for the help!

Best,
Bolun Chen

### Jason Sherfey via DynaSim

Apr 28, 2020, 3:32:59 PM4/28/20
to Dyn...@groupspaces.com
Hi Bolun,

Dynasim does not have any solvers implemented that are specifically designed for SDEs. If you have a built-in Matlab or third-party function that implements the Euler-Mayamara method, there is a way to use that function to integrate a SDE model built using Dynasim. The basic approach is to specify your SDE in Dynasim, like any regular ODE model, then convert the model specification into a function handle using dsDynasim2odefun. The resulting function handle can be passed to the integrator that implements the desired method. If you decide to do this, let me know. I can help if you have trouble and then turn it into a Dynasim SDE tutorial for future reference.

I hope this helps.

Best,
Jason

### Bolun Chen

Apr 28, 2020, 5:28:33 PM4/28/20
to Dyn...@groupspaces.com, Jason Sherfey
Hi Jason,

Thank you for the quick reply and suggestions. I’ll try to implement a sde solver and test it on one or two simple examples (like OU process and LIF neuron with noise input). I’ll let it know if I run into troubles. Thanks again!

Best,
Bolun

 You are subscribed as blc...@brandeis.edu