1
$\begingroup$

I have just started getting into ODEs, and have come across the Runge-Kutta method for numerically solving them. However, in playing around with them to model hypothetical situations, I came across the equations:

$$\begin{aligned} \dot x &= x - x^2 - y\\ \dot y &= xy - y^2 \end{aligned}$$

I was trying to think of how one would use Runge Kutta methods to do this, and I couldn't figure it out. What is this type of differential equation called, and how can I simulate/solve it?

$\endgroup$

1 Answer 1

1
$\begingroup$

The Runge-Kutta formulas for a system of differential equations are really the same as for a single equation, it's just that your dependent variable is a vector rather than a scalar. Write your system as $$\dfrac{dX}{dt} = F(t, X(t))$$ where $X = (x, y)$. If you're using the classical fourth-order Runge-Kutta with step size $h$, your iteration is $$ \eqalign{K_1 &= h F(t_n, X_n)\cr K_2 &= h F(t_n + h/2, X_n + K_1 /2)\cr K_3 &= h F(t_n + h/2, X_n + K_2 /2)\cr K_4 &= h F(t_n + h, X_n + K_3)\cr t_{n+1} &= t_n + h\cr X_{n+1} &= X_n + (K_1 + 2 K_2 + 2 K_3 + K_4)/6\cr}$$

$\endgroup$
4
  • $\begingroup$ So what would $F$ be for OP's question? $\endgroup$ Commented Apr 1, 2019 at 15:15
  • $\begingroup$ $F(t, (x,y)) = (x - x^2 - y, x y - y^2)$. $\endgroup$ Commented Apr 1, 2019 at 15:16
  • $\begingroup$ but RHS is $(x−x^2−y,xy−y^2)=(\frac {dx}{dt},\frac {dy}{dt})$. Why is this the same as LHS? $\endgroup$ Commented Apr 1, 2019 at 15:20
  • $\begingroup$ What do you mean? $ x - x^2 - y$ is the first entry of $F(t,X)$, and that is the derivative of the first entry of $X$, i.e. $dx/dt$. $xy - y^2$ is the second entry of $F(t,X)$, and that is the derivative of the second entry of $X$, i.e. $dy/dt$. $\endgroup$ Commented Apr 1, 2019 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .