Euler's method for second order DE

Click For Summary
SUMMARY

The discussion focuses on the application of the Euler method to solve second-order differential equations (DE), specifically the equation ##\ddot x=\omega^2 x##. Participants clarify that higher-order DE can be transformed into a system of first-order DE by introducing new variables, such as setting ##v := y'##. The correct application of the Euler method is confirmed as ##y'_{n+1} = y'_n + h\omega^2y_n##, which aligns with the initial conditions provided. The conversation emphasizes the importance of understanding the transformation process for effective implementation of numerical methods.

PREREQUISITES
  • Understanding of second-order differential equations
  • Familiarity with the Euler method for numerical approximation
  • Knowledge of vector representation of differential equations
  • Basic concepts of initial conditions in differential equations
NEXT STEPS
  • Learn about converting higher-order DE to first-order systems
  • Explore numerical methods for solving differential equations, focusing on the Euler method
  • Study the implications of initial conditions on numerical solutions
  • Investigate the stability and accuracy of the Euler method in various applications
USEFUL FOR

Mathematicians, engineers, and students studying differential equations, particularly those interested in numerical methods and their applications in physics and engineering contexts.

Karol
Messages
1,380
Reaction score
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
Wouldn't the Euler method dictate $$y'_{n+1} = y'_n + h\omega^2y_n$$ ?
 
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.
 
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
 
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.
 
Thank you very much BvU and Krylov
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
477
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K