2nd order Runge-Kutta method for linear ODE Could someone please help me with the next step of this 2nd order Runge-Kutta method?
I am solving the following initial value problem (IVP)
$$x' = - \frac12 x(t), \qquad x(0)=2$$
I wish to use the second order Runge-Kutta method
$$x(t+h)=x(t)+1/2(F_1+F_2),$$
where \begin{align*}
F_1&=hf(t,x) \\
F_2&=hf(t+h,x+F_1).
\end{align*}
Let us use a spacing of $h=1$.
My working goes like this:
$$F_1 = -\frac{x(0)}{2}=-1.$$
Then
\begin{align*}F_2&=1\times f(0+1,x(0)+F_1) \\
&=-1/2 \times x(1).\end{align*}
But I have no idea what $x(1)$ is.
 A: Integrating the ODE
$$\dot x = -\frac{1}{2} x$$
we get
$$x (t) = x_0 \cdot \exp\left(-\frac{t}{2}\right)$$
Hence,
$$\begin{array}{rl} x (t+h) &= x_0 \cdot \displaystyle\exp\left(-\frac{t+h}{2}\right)\\\\ &= x_0 \cdot \displaystyle\exp\left(-\frac{t}{2}\right) \cdot \exp\left(-\frac{h}{2}\right)\\\\ &= \displaystyle\exp\left(-\frac{h}{2}\right) \cdot x (t)\\\\ &= \displaystyle\left(1 - \frac{h}{2} + \frac{h^2}{8} - \frac{h^3}{48} + \frac{h^4}{384} - \cdots\right) x(t)\end{array}$$
Using the 2nd order Runge-Kutta, we truncate
$$x (t+h) \approx \displaystyle\left(1 - \frac{h}{2} + \frac{h^2}{8}\right) x(t)$$
A: $F_1$ is a constant. $F_2$ is a function of $x_1$. So on the right hand side of the original equation you have a $x_1$ term as well as the LHS is itself $x_1$ Bring them to the same side and solve
A: In explicit methods there are no implicit equations.
In the explicit trapezium or Heun method, the second stage is computed as
$$
F_2=hf(t_0+h,x_0+F_1)
$$
Now with $F_1=-1$ you get $x_0+F_1=2-1=1$ and thus
$$
F_2=-\frac{x_0+F_1}2=-\frac12.
$$
You get
$$
x_1=x_0+\frac{F_1+F_2}2=2-\frac34=\frac54
$$
as approximation of $x(1)$.
