View Full Version : IMSL for solving ODE with complex coefficients

12-16-2012, 11:45 PM
Trying to find an IMSL solver for a set of coupled ordinary differential equations of the form
(d/dt)(An)=iBn(t)An+SUM (Tnq(z)Aq +Tn,q+1Aq+1......where An(0)=1, Aq(0)=0 with q not equal n
where i is sqrt of -1 so the functions have complex numbers in them.

The routines IVPRK, IVMRK,IVPAG are set up for first order ordinary differential equation with initial values, but
there is no mention of whether these can deal with equations with complex coefficients.

The basic equation form is
y1'=a(t)y1+b(t)y2+c(t)y3 ......
y2'=d(t)y2+e(t)y1+f(t)y3 ....
where typically a(t),b(t)...are complex and y1(0)=1, y2(0)=0,y(0)=0....
and the goal is to find values of y1,y2--as a function of t.

None of the examples for these routine mention complex coefficients. From the literature I know these equations can be
solve by a Runge Kutta integration. This is related to mode conversion in over moded circular microwave waveguides.

Any suggestions would be welcome.

Richard Hanson
12-17-2012, 08:06 AM
Try this formulation so you can use a real equation integrator:

Define y(t)= u(t) + i v(t), where y is an n-vector, and so are u and v. But u and v are both real. Your problem is y'=f(y,t), say.

Then the system is broken into 2n real equations, for u and v.
This system can be organized so that this real system has the form (u_1, v_1, ..., u_n, v_n)' = F(u,v,t).

The computation of F in your derivative routine may be easier to evaluate numerically if you reconstruct y=u+iv, then evaluate your given f(y,t) as a complex vector. The real parts of derivatives, f, go with u_1,...,u_n and the imaginary parts with v_1,...,v_n.

Initial values for the u_j and v_j, j=1,...,n, follow from y(0).

If the equations are stiff use the integrator DAESL instead of any in the group you mention. There are further issues to consider if the equations are stiff.

BTW this reformulation could be used with any integrator that handles real equations. Essentially all the ODE packages that are available deal with real equations.