# Initial Value Problem into Euler and Runge-Kutta scheme

Having a bit of difficulty with this question:

Convert the initial value problem,

$$\frac{d^2y}{dx^2}-\frac{dy}{dx}+2y=x+1$$ where $$y(0)=2,\ \frac{dy}{dx}(0)=-1,$$

into a set of two coupled first-order initial value problems.

Firstly I let $$\frac{dy}{dx}=z$$ giving me the equation:

$$\frac{dz}{dx}=z-2y+x+1$$ where $$y(0)=2,\ z(0)=-1,\ x(0)=0$$

Use a step length h = 0.1 to find numerical approximations to y at x = 0.2 using generalizations to two coupled equations of the following numerical schemes:

1. Trapezoidal method using the explicit Euler method as a predictor and one iteration of the corrector.

for this method I'm really confused and don't know where to start so any help would be great.

1. the third-order Runge-Kutta scheme: $$k_1 = hf (x_n, y_n)\\ k_2=hf(x_n+\frac{h}{2},y_n+\frac{k_1}{2})\\ k_3=hf(x_n+h,y_n-k_1+2k_2)\\ y_{n+1}=y_n+\frac{1}{6}(k_1+4k_2+k_3)$$

for this method I'm a little confused I don't know where to start because of the 3 different variables z,y,x I tried starting by doing $$k_1=hz_0$$ and then $$l_1=hf(x_0,y_0)$$ but I found it difficult because of the 3 variables, any help is appreciated thanks.

• Note: I've split this into 3 variables using $$\frac{dy}{dx}=f(x,y,z)=z$$ and got to the solution of $$k_2\ and \ l_2$$ but cant seem to figure out $$k_3$$ – Reety Jan 15 '18 at 23:48

1. Trapezoidal method with Euler as predictor and one corrector step can be implemented as a 3-stage Runge-Kutta method for the vector $u=(y,z)$ \begin{align} k_1 &= hf(x,u)\\ k_2 &= hf(x+h,u+k_1)\\ k_3 &= hf(x+h,u+0.5(k_1+k_2))\\ u_+ &= u+0.5(k_1+k_3) \end{align}
There are only 2 components to this differential equation, the independent variable $x$ has explicitly available updates.