How to solve following system of ordinary differential equations using Octave?
$\frac{dx}{dt} = - [x(t)]^2 - x(t)y(t)$ $\frac{dy}{dt} = - [y(t)]^2 - x(t)y(t)$
Update: initial conditions: $x(t=0) = x_0, \space y(t=0) = y_0$
How to solve following system of ordinary differential equations using Octave?
$\frac{dx}{dt} = - [x(t)]^2 - x(t)y(t)$ $\frac{dy}{dt} = - [y(t)]^2 - x(t)y(t)$
Update: initial conditions: $x(t=0) = x_0, \space y(t=0) = y_0$
Here is a solution computed by Maple,
$ x \left( t \right) = {\frac {x_{{0}}}{y_{{0}}t+x_{{0}}t+1}},y \left( t \right) = {\frac {y_{{0}}}{y_{{0}}t+x_{{0}}t+1}}.$
You could use Euler's method, which would use the approximation $\frac{\mathrm{d}x}{\mathrm{d}t}\approx\frac{x(t+\Delta t)-x(t)}{\Delta t}$ for some "small" $\Delta t$. Then the problem becomes finite difference problem $x(t_{n+1})=x(t_{n})+\Delta t\bigl[ - [x(t)]^2 - x(t)y(t)\bigr]$ $y(t_{n+1})=y(t_{n})+\Delta t\bigl[ - [y(t)]^2 - x(t)y(t)\bigr]$ where $t_{n}=t_{0}+n\Delta t$.
Of course, the slick way is to change coordinates to $u=x+y,\quad\mbox{and}\quad v=x-y$ so your differential equations become $\dot{u}=-u^{2}$ and $\dot{v}=-uv$ which are quite trivial.