help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to solve du/dt = i*u


From: John B. Thoo
Subject: Trying to solve du/dt = i*u
Date: Thu, 30 Apr 2009 20:25:30 -0700

Hi, everyone.

As a toy problem, I'm trying to solve du/dt = i*u, where i^2 = -1. This is what I've tried and gotten:

octave-3.0.5:1> function udot = f (u, t)
> udot = I*u;
> endfunction
octave-3.0.5:2> u0 = 1;
octave-3.0.5:3> t = linspace (0, 5, 10);
octave-3.0.5:4> u = lsode ("f", u0, t);
warning: lsode: ignoring imaginary part returned from user-supplied function
octave-3.0.5:5> plot (t, u)
octave-3.0.5:6>

Gnuplot gives the constant graph  u = 1  for  t = 0..5.

What am I doing wrongly?

Eventually, I'd like to solve a system like this:

udot(1) = -i*u(3)*u(2)' - i*u(2)*u(1)';
udot(2) = -2*i*u(3)*u(1)' - i*u(1)*u(1);
udot(3) = -3*i*u(2)*u(1);

(I'm using  '  for complex conjugate.  Is that correct?)

Thanks for any help you can give.

---John.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]