# Why do we get oscillations in Euler's method of integration and what i

1. Jul 8, 2014

### ErezAgh

When using Euler's method of integration, applied on a stochastic differential eq. :

For example - given
d/dt v=−γvΔt+sqrt(ϵ⋅Δt)Γ(t)
we loop over

v[n+1]=v[n]−γv[n]Δt+sqrt(ϵ⋅Δt)Γn.
(where −γv[n] is a force term, can be any force and Γn is some gaussian distributed random variable. ) .

Then if we choose Δt not small enough, we eventually get (if we run over long times, meaning many repeated iterations) that the solutions become "unstable and oscillations appear around the analytic solution, with amplitude becoming larger and larger with time" (~ collected from many different sources I found on the internet that mention the problem but don't discuss it in depth).

Why are these actual OSCILLATIONS, and not simply random fluctuations? What is the period of these oscillations?

2. Jul 8, 2014

### MrAnchovy

For the same reason single-step numerical integration is unstable for non-stochastic problems when the step size is large enough so that each step 'overshoots' the analytic solution.

Er, the step size.

3. Jul 8, 2014

### pasmith

Consider the non-stochastic ODE $$y' = -ky$$ with $k > 0$ and $y(0) = 1$. This can be solved analytically: $$y(t) = e^{-kt}.$$ Note that $y \to 0$ as $t \to \infty$. Applying Euler's method with step size $h > 0$ we obtain $$y_{n+1} = y_n - hky_n = y_n(1 - hk)$$ which again can be solved analytically:
$$y_n = (1 - hk)^n.$$ Thus the error at time $t = nh$ is given by $$\epsilon_n = y(nh) - y_n = e^{-nhk} - (1 - hk)^n.$$ If $hk > 2$ then $1 - hk < -1$, so that $$\epsilon_n = e^{-nhk} - (-1)^n|1 - hk|^n.$$ Thus, since $|1 - hk| > 1$ and $e^{-nhk} < 1$, we see that $|\epsilon_n| \to \infty$ and that $\epsilon_n$ is alternatively positive and negative (which is what "oscillates" means in this context).

4. Jul 8, 2014

### ErezAgh

Thanks a lot both!

1) I see why it oscillates with a frequency of 1 step, (-1)^n, so this means you normalized the step size to be Er=1?
2) Silly question perhaps, but can this be written in the form of a sine() than?

Last edited: Jul 8, 2014