Euler's method for second order DE

In summary, the conversation discusses the use of the Euler approximation method to solve higher order differential equations. It is mentioned that the method can be used by converting the DE into a system of first-order DE, as demonstrated through an example with initial conditions. The possibility of using this method for solving a free harmonic oscillator is also brought up. The conversation ends with a discussion on how to correctly quote equations and mention other members in a post.
  • #1
Karol
1,380
22
Can the Euler approximation method be used to solve higher order DE?
I have ##\ddot x=\omega^2 x## which i rewrite as ##y''=\omega^2y##. initial conditions y(0)=0, y'(0)=1.
The Euler method: ##y_{n+1}=y_n+h\cdot y'_n##. i use this to make:
$$y''_{n+1}=y'_n+h\cdot y''_n~~\rightarrow~~\omega^2y_{n+1}=y'_n+h\omega^2 y_n$$
$$\omega^2(y_n+hy'_n)=y'_n+h\omega^2 y_n$$
$$\rightarrow~y'_n=\left[ \frac{\omega^2(1-h)}{1-\omega^2h} \right]y_n$$
But this contradicts the initial condition y'(0)=1, after i substitute y(0)=0 in the formula i found.
 
Physics news on Phys.org
  • #2
Wouldn't the Euler method dictate $$y'_{n+1} = y'_n + h\omega^2y_n$$ ?
 
  • #3
Karol said:
Can the Euler approximation method be used to solve higher order DE?
Yes, every explicit first order method can be used to solve higher-order DE by writing the DE in vector form as a system of first-order DE, also see below.
Karol said:
I have ##\ddot x=\omega^2 x## which i rewrite as ##y''=\omega^2y##. initial conditions y(0)=0, y'(0)=1.
I do not quite understand the purpose of introducing ##y##, but it does no harm. Also, this equation looks like a free harmonic oscillator. Are you sure there should not be a minus in front of ##\omega^2##?
Karol said:
The Euler method: ##y_{n+1}=y_n+h\cdot y'_n##.
BvU said:
Wouldn't the Euler method dictate $$y'_{n+1} = y'_n + h\omega^2y_n$$ ?
I think that the OP and @BvU both have one half of the method for this problem :wink:.

As I alluded to at the start, you can solve higher order DE by converting them into a system of first order DE. Although not strictly necessary, this works best by introducing new symbols for the derivatives. For this example, set ##v := y'##, then the DE ##y''(t) = \omega^2y(t)## is equivalent to
$$
\left\{
\begin{align*}
y'(t) &= v(t)\\
v'(t) &= \omega^2y(t)
\end{align*}
\right.
$$
with the initial conditions ##y(0) = 0##, ##v(0) = 1##. Then Euler forward with stepsize ##h > 0## just reads
$$
\begin{align*}
\begin{bmatrix}
y_{n+1}\\
v_{n+1}
\end{bmatrix}
&\approx
\begin{bmatrix}
y_n\\
v_n
\end{bmatrix}
+
h
\begin{bmatrix}
y'(nh)\\
v'(nh)
\end{bmatrix}\\
&=
\begin{bmatrix}
y_n\\
v_n
\end{bmatrix}
+
h
\begin{bmatrix}
v_n\\
\omega^2y_n
\end{bmatrix}
\end{align*}
$$
where ##y_n := y(nh)## and ##v_n := v(nh)## for ##n = 0, 1,\ldots##. The first component is what the OP called the Euler method, while the second component appears in post #2.
 
  • #4
Krylov said:
this equation looks like a free harmonic oscillator. Are you sure there should not be a minus in front of ##\omega^2## ?
It is taken from a mathematics book, teaching DE, not a physics book.
I thank you very much BvU and Krylov.
How do you quote exactly also the equations in the posts, since when i use the "+Quote" function that is given in this site, or i mark a part of a post and select "+Quote" from the context menu that appears, and then insert these quotes in the reply box the equations come out messed, while the text is good. i manually fix these equations, almost completely write them anew.
And also, how can you copy a poster's name, like Krylov did in the last post:
Snap1.jpg
 
  • #5
Karol said:
It is taken from a mathematics book, teaching DE, not a physics book.
I thank you very much BvU and Krylov.
Ok. Whenever I see an ##\omega^2## somewhere, I start to think of ##\tfrac{k}{m}##.
You are welcome!
Karol said:
How do you quote exactly also the equations in the posts, since when i use the "+Quote" function that is given in this site, or i mark a part of a post and select "+Quote" from the context menu that appears, and then insert these quotes in the reply box the equations come out messed, while the text is good. i manually fix these equations, almost completely write them anew.
I recognize this and it is a bit uncomfortable. Probably there are better ways, but what usually do, is put the cursor where I want the quote (with formulas) to appear and then press "reply". This quotes the entire message with formulas correctly. Then I remove the excess text that I do not want quoted.

You can also right-click on an equation, then "Show Math As", then "TeX Commands". This opens a pop-up containing the ##\LaTeX## source. That context menu has some other options, too, it appears.
Karol said:
And also, how can you copy a poster's name, like Krylov did in the last post:
You write the member name with an "@" in front, like @Karol. When the member has enabled this, it will show him a message that he has been "mentioned" in a certain thread.
 
  • #6
Thank you very much BvU and Krylov
 

FAQ: Euler's method for second order DE

What is Euler's method for second order differential equations?

Euler's method is a numerical method for approximating the solution to a second order differential equation. It uses a series of small steps to estimate the value of the solution at each point.

How does Euler's method work?

Euler's method works by breaking down a second order differential equation into a series of first order equations, which can then be solved using a simple iterative process. This involves using the derivative of the solution at a given point to estimate the value of the solution at the next point.

What are the advantages of using Euler's method?

Euler's method is relatively easy to implement and does not require advanced mathematical knowledge. It is also useful for solving differential equations that do not have analytical solutions.

What are the limitations of Euler's method?

Euler's method is known to produce less accurate results compared to other numerical methods, especially when the step size is large. It also has a tendency to accumulate errors, leading to inaccurate solutions over time.

How can the accuracy of Euler's method be improved?

The accuracy of Euler's method can be improved by reducing the step size, which means taking more smaller steps to approximate the solution. This reduces the accumulation of errors and leads to a more accurate solution. Alternatively, using a higher-order numerical method, such as the Runge-Kutta method, can also improve the accuracy of the solution.

Back
Top