Solving system of differential equations using Runge Kutta method

2k Views Asked by At

I have two differential equations:

\begin{align}\frac{dx}{dt} &= 1 -(1+b)x+ax^2y\\ \frac{dy}{dt} &= bx - ax^2y\end{align}

I have been asked to solve them on Python using the Runge Kutta (4th order) method. I know how to solve a single ODE using this method, but don't know how to extend it to a system of ODEs.

Any help (or pointers) would be greatly appreciated,

Jack

1

There are 1 best solutions below

6
On

HINT

You can reduce your system using the first equation: $$ ax^2y = x' - 1+b+bx $$ and so $$ y = \frac{x' - 1+b+bx}{ax^2} $$ (assuming $a \ne 0$) and now your ODE system will become a 2nd order ODE.