# Using Octave to solve systems of two non-linear ODEs

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$

-
What are the initial conditions? Also, since Octave is the free version of MATLAB, you may get better results including it in google searches also. –  Daryl Nov 27 '12 at 3:44
What kind of solution can Octave give you? –  Mhenni Benghorbal Nov 27 '12 at 8:52
Here is a related problem. –  Mhenni Benghorbal Nov 27 '12 at 8:58
@MhenniBenghorbal: I am counting on analytical solution.. Not sure if I can get it from Octave –  Drenet Nov 30 '12 at 5:14

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}}.$$

-
I just posted the same solution here. I don't have the luxury of a computer system, so my brain got a work out. –  Daryl Nov 30 '12 at 5:56
@Daryl: Good for you. –  Mhenni Benghorbal Nov 30 '12 at 6:05

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.

-