# 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 $\displaystyle 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:

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

and

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

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

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

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

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

$\displaystyle 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

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

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

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

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

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

and so on!

Well, hope that helps!