[SciPy-user] ode on complex systems

lorenzo bolla lbolla@gmail....
Fri Nov 16 08:53:00 CST 2007


Hi all,
can I use any of scipy.integrate.ode/odeint etc. for complex systems? How?

Here is what I'm doing, but I only get r.y real, instead of complex (and the
result is different from Matlab).

----------------------------------------

import
numpy

import scipy.integrate.ode



def f(t, y, betaA, betaB,
CAB):

    M = numpy.array([[1j * betaA, CAB], [-CAB, 1j *
betaB]])

    return numpy.dot(M,
y)



betaA =
1.

betaB =
1.

CAB =
1.



t0 =
0.

t1 =
1.

dt =
.01

y0 = numpy.array([1,
0]).astype(complex)



r = scipy.integrate.ode(f).set_integrator('vode').set_initial_value(y0,
t0).set_f_params(betaA, betaB,
CAB)

while r.successful() and r.t <
t1:

    r.integrate(r.t +
dt)

    print r.t, r.y



----------------------------------------

Thank you in advance,
Lorenzo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071116/f19de794/attachment-0001.html 


More information about the SciPy-user mailing list