[Math] Modified Euler Method for second order differential equations

numerical methodsordinary differential equations

The question I am doing is asking me to carry out the Modified Euler method for a second order differential equation:

Consider the following initial value problem:
$$y''=\frac{2}{x}y'-\frac{2}{x^2} y – \frac{1}{x^2},\quad y(1)=0, \quad y'(1)=1$$
Calculate the numerical solution at $x=1.2$ using the modified Euler's method. Take the step length $h=0.2$ and work to $6$ decimal digit accuracy.

So far whilst studying ODEs I have only come across numerical methods for first order differential equations. How do I go about solving this?

Usually, $f(x,y) = y'$ but what does $f(x,y)$ equal this time?

Best Answer

As lhf mentioned, we need to write this as a system of first order equations and then we can use Euler's Modified Method (EMM) on the system.

We can follow this procedure to write the second order equation as a first order system. Let $w_1(x) = y(x)$, $w_2(x) = y'(x)$, giving us:

  • $w'_1 = y' = w_2$
  • $w'_2 = y'' = \left(\dfrac{2}{x}\right)w_2 -\left(\dfrac{2}{x^2}\right)w_1 - \dfrac{1}{x^2}$

Our initial conditions become:

$$w_1(1) = 0, w_2(1) = 1$$

Now, you can apply EMM and you can see how you step through that (only Euler method, but it will give you the approach) at The Euler Method for Higher Order Differential Equations

From the given conditions, we are only doing one step of the algorithm, since we are starting at $x=1$ and want to find the result at $x=1.2$, where $h=0.2$.

Also note, we can compare the numerical solution to the exact result, which is:

$$y(x) = \dfrac{1}{2}\left(x^2-1\right)$$

That should be enough to guide you.