cbherbert / stochrare

This Python package aims at providing tools to study stochastic processes: integrate SDEs, solve Fokker-Planck equations, sample rare events,...
GNU General Public License v3.0
8 stars 5 forks source link

OrnsteinUhlenbeck1D ignores parameter mu in update method #26

Open AlessandroLovo opened 2 years ago

AlessandroLovo commented 2 years ago

In sr.dynamics.diffusion1d.OrnsteinUhlenbeck1D.update the position update due to the drift term is obtained by multiplication by an exponential term. This assumes mu=0

AlessandroLovo commented 2 years ago

Original line of code: xx = xn*np.exp(-self.theta*dt) + np.sqrt(self.D0/self.theta*(1-np.exp(-2*self.theta*dt)))*dw

Proposed fix xx = (xn - self.mu)*np.exp(-self.theta*dt) + self.mu + np.sqrt(self.D0/self.theta*(1-np.exp(-2*self.theta*dt)))*dw