0
$\begingroup$

Suppose I have the following system of differential equations: $$ \begin{cases} y'_{1} (t) = y_{2}(t) - y_{1}(t) \\ y'_{2}(t) = -y_{1}(t)y_{2}(t) \end{cases} $$ with the initial conditions: $$ y_{1}(0) = 1,\ y_{2}(0) = 2 $$

I would like to compute $y_{1}(1)$ and $y_2(1)$ using a single step of the Runge-Kutta method with the following Butcher tableau:

$$ \begin{array}{c|cc} 0 & 0 & \\ 1 & 1 & 0 \\ \hline & \frac{1}{2} & \frac{1}{2} \\ \end{array} $$


I've started by writing out my system of equations in vector form:

$\overrightarrow {y}(t) = \begin{bmatrix} y_{1}(t) \\ y_{2}(t) \end{bmatrix} $, $\overrightarrow {f}(t, \overrightarrow {y}(t)) = \begin{bmatrix} y_{2}(t) - y_{1}(t) \\ -y_{1}(t)y_{2}(t) \end{bmatrix} $, and $\overrightarrow {y}(0) = \begin{bmatrix} 1 \\ 2 \end{bmatrix} $

Now I am solving the following system:

$$ \overrightarrow {y}'(t) = \overrightarrow {f}(t, \overrightarrow y(t)) $$

IIUC, this is how you build the solution:

$$ \overrightarrow {y}_{1} = \overrightarrow {y}_{0} + \frac{1}{2} \overrightarrow {k_{1}} + \frac{1}{2} \overrightarrow {k_{2}} $$

where $k_{1}$:

$$ \overrightarrow {k_{1}} = h \cdot \overrightarrow {f}(0 + 0 \cdot h, \overrightarrow {y}(0)) = \overrightarrow {f}(0, \overrightarrow {y}(0)) = \begin{bmatrix} 2 - 1 \\ -1 \cdot 2 \end{bmatrix} = \begin{bmatrix} 1 \\ -2 \end{bmatrix} $$

and $k_{2}$:

$$ \overrightarrow{k_{2}} = h \cdot \overrightarrow{f}(0 + 1 \cdot h, \overrightarrow{y}(0) + 1 \cdot \overrightarrow{k_{1}}) = \overrightarrow{f}(1, \overrightarrow{y}(0) + \overrightarrow{k_{1}}) = \overrightarrow{f}(1, \begin{bmatrix} 2 \\ 0 \end{bmatrix}) $$

I think I've got it right so far (I'd appreciate the notation edits as I'm not really sure I got everything down correctly).


Now, I don't know how to compute this:

$$ \overrightarrow{f}(1, \begin{bmatrix} 2 \\ 0 \end{bmatrix}) $$

According to my understanding, this would lead to evaluating $y_{1}(1)$ and $y_{2}(1)$ as part of my computation. But these are the values I'm trying to compute with my method! Therefore, I must have done something wrong.

$\endgroup$

1 Answer 1

2
$\begingroup$

What you got in $\vec y(0)+\vec k_1$ is a first approximation of the value at $\vec y(1)$. But it is the Euler value, first order. With $\vec k_2$ and the composition formula you compute a better approximation of order 2.

So forget the context for a moment and just compute the function value of $\vec f$.

$\endgroup$
4
  • $\begingroup$ So, $\overrightarrow k_{2} = (-2, 0)^{T}$? $\endgroup$ Commented Aug 21, 2024 at 6:21
  • 1
    $\begingroup$ Yes, simply that. Of course that means that $k_1+k_2=0$, so that $y(1)\approx y(0)$. For more accurate results you need a smaller step size. This ODE and method could be implemented in Excel or similar, if you have no BASIC or Python available. $\endgroup$ Commented Aug 21, 2024 at 16:33
  • $\begingroup$ $\overrightarrow {k_{1}} + \overrightarrow {k_{2}} = (-1, -2)^{T}$ according to my calculations. Precision of the result is not important to me at this time, only the correct procedure since this is an exam question. $\endgroup$ Commented Aug 21, 2024 at 16:57
  • 1
    $\begingroup$ Yes, that is correct, I was reading too fast and taking some close prominent vector. But still, with changes the same size as the components the step size is likely much too large. $\endgroup$ Commented Aug 21, 2024 at 21:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.