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

In summary, when using Euler's method of integration on a stochastic differential equation, if the step size is not small enough, the solutions become unstable and oscillations appear around the analytic solution. These oscillations have a frequency of 1 step and can be alternatively positive and negative. This can be explained by considering the non-stochastic ODE y' = -ky and applying Euler's method with a large step size, resulting in the error oscillating between positive and negative values.
  • #1
ErezAgh
5
0
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?
 
Mathematics news on Phys.org
  • #2
ErezAgh said:
Why are these actual OSCILLATIONS, and not simply random fluctuations?

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.

ErezAgh said:
What is the period of these oscillations?

Er, the step size.
 
  • #3
ErezAgh said:
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?

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

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:
  • #5


The oscillations in Euler's method of integration are a result of the approximation used in the numerical algorithm. In this method, the differential equation is approximated by a series of smaller steps, with the assumption that the solution remains constant within each step. However, in reality, the solution may change significantly within each step, leading to errors in the numerical approximation.

As a result, these errors accumulate over time, causing the solution to deviate from the true solution and exhibit oscillations. These oscillations are not random fluctuations, but rather a result of the cumulative error in the numerical approximation.

The period of these oscillations can vary depending on the specific problem and the chosen step size. In general, smaller step sizes will lead to shorter periods of oscillations, as the errors are smaller and accumulate at a slower rate. However, there is no fixed period for these oscillations, as they are a result of the specific dynamics of the system being modeled.

To avoid these oscillations, it is important to choose a small enough step size and to carefully consider the dynamics of the system being modeled. Other methods of integration, such as the Runge-Kutta method, may also be more accurate and stable for certain types of differential equations.
 

1. Why do we get oscillations in Euler's method of integration?

Euler's method of integration is a numerical method used to approximate the solution of a differential equation. It is a first-order method, meaning that it uses only one point to estimate the next point. This can lead to errors and discrepancies in the approximation, resulting in oscillations.

2. How do these oscillations affect the accuracy of the approximation?

The oscillations in Euler's method can significantly affect the accuracy of the approximation. As the oscillations increase, the error in the approximation also increases. This can lead to incorrect results and a poor representation of the actual solution of the differential equation.

3. Can these oscillations be reduced or eliminated?

Yes, there are ways to reduce or eliminate the oscillations in Euler's method. One approach is to use a smaller step size, which means using more points to approximate the solution and reducing the error. Another method is to use a higher-order method, such as the Runge-Kutta method, which is more accurate and less prone to oscillations.

4. What can cause these oscillations in Euler's method?

There are several factors that can contribute to the appearance of oscillations in Euler's method. These include a large step size, a high degree of nonlinearity in the differential equation, and discontinuities in the function being approximated. These factors can lead to a larger error in the approximation, resulting in oscillations.

5. Is Euler's method the only numerical method that can produce oscillations?

No, Euler's method is not the only numerical method that can produce oscillations. Other numerical methods, such as the predictor-corrector method, can also lead to oscillations under certain conditions. It is important to carefully choose the appropriate numerical method for a given problem to minimize oscillations and improve the accuracy of the approximation.

Similar threads

Replies
5
Views
8K
Replies
1
Views
2K
Replies
8
Views
1K
  • Introductory Physics Homework Help
Replies
9
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
25
Views
4K
  • Advanced Physics Homework Help
Replies
4
Views
2K
Replies
42
Views
3K
Replies
19
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
7K
  • Classical Physics
Replies
0
Views
134
Back
Top