1
$\begingroup$

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$

  • 1
    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.2012-11-27
  • 0
    What kind of solution can Octave give you?2012-11-27
  • 0
    Here is a [related problem](http://math.stackexchange.com/questions/221534/coupled-nonlinear-ode/221587#221587).2012-11-27
  • 0
    @MhenniBenghorbal: I am counting on analytical solution.. Not sure if I can get it from Octave2012-11-30

2 Answers 2

2

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

  • 0
    I just posted the same solution [here](http://math.stackexchange.com/a/247849/36034). I don't have the luxury of a computer system, so my brain got a work out.2012-11-30
  • 0
    @Daryl: Good for you.2012-11-30
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.