help-octave
[Top][All Lists]
Advanced

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

Re: Trying to solve du/dt = i*u


From: James Sherman Jr.
Subject: Re: Trying to solve du/dt = i*u
Date: Thu, 30 Apr 2009 23:57:10 -0400

I don't believe that lsode can handle imaginary components (hence the warning).  There may be a function that can handle complex functions, but I don't know of any myself.  There maybe something in the odepkg found at http://octave.sourceforge.net/packages.html.

Sorry I can't be of more help.

James

On Thu, Apr 30, 2009 at 11:25 PM, John B. Thoo <address@hidden> wrote:
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.
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave


reply via email to

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