2nd order Runge-Kutta method for linear ODE

565 Views Asked by At

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.

2

There are 2 best solutions below

0
On

$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

0
On

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)$$