# Thread: Numerical methods for systems

1. ## Numerical methods for systems

x' = x + 2y, x(0) = 0, y' = x + e^-t, y(0) = 0; x(t) = (1/9)(2e^(2t) - 2e^-t - 6te^-t), y(t) = (1/9)(e^(2t) - e^-t + 6te^-t)

An initial value problem and its exact solution are given. Use the Runge-Kutta method with step sizes h = 0.1 and h = 0.05 to approximate to five decimal places the values x(1) and y(1).

I have a TI-89 calculator with the proper programs to solve this problem. I am having trouble getting this problem started because of the t in "y' = x + e^-t". Can anyone get me past this???

2. This shouldn't be a problem as you just need to put $t$ in terms of the iteration number and evaluate as usual.

For example for the second order RK method you would iterate the two equations as follows. First I'll write your differential equations in the general form:

$\partial_t x = f(t,x,y)$

and

$\partial_t y = g(t,x,y)$

so $x$ and $y$ need to be stepped simultaneously as follows:

$k_1 = h f(t_n , x_n, y_n)$

$l_1 = h g(t_n, x_n, y_n)$

$k_2 = h f \left(t_n +\frac{1}{2}h , x_n + \frac{1}{2} k_1 , y_n + \frac{1}{2} l_1 \right)$

$l_2 = h g \left(t_n +\frac{1}{2}h , x_n + \frac{1}{2} k_1 , y_n + \frac{1}{2} l_1 \right)$

then

$x_{n+1} = x_n + k_2$
$y_{n+1} = y_n + l_2$

and of course $t_{n+1} = t_n + h = (n+1)h$.

So for your problem you start with $x_0=y_0 = 0$ at $t=0$ and the following evaluations:

$k_1 = h (0 +2 \cdot 0 ) = 0$
$l_1 = h (0 + e^{0}) = h$
$k_2 = h(0 + 2 h) = 2 h^2$
$l_2 = h ( 0 + e^{- 1/2 h}) = h e^{- 1/2 h}$

so then
$x_1 = 0 + 2 h^2 = 2 h^2$
$y_1 = 0 + h e^{-1/2 h} = h e^{-1/2 h}$

and so on!

Well, hope that helps!