# Differential equations with a complex variable

Is Mathematica able to handle ordinary differential equations where the variable itself is complex? I am looking for solutions of ODE systems of the form \left\{ \begin{align} i\frac{da_1}{dt} &=E_1a_1(t)+\mu\cos(\omega t)a_2(t) \\ i \frac{da_2}{dt}&=\mu\cos(\omega t)a_1(t)+E_2a_2(t), \end{align}\right. and I need to use the analytical continuation of the solutions to a contour that consists of a number of straight-line segments on the complex plane. (Why? because of things like this.)

My naive try would be

NDSolve[{
I a1'[t] == E1 a1[t] + μ Cos[ω t] a2[t],
I a2'[t] == E2 a2[t] + μ Cos[ω t] a1[t],
a1[0] == 1, a2[0] == 0},
{a1, a2}, {t, 0, I (2 π)/ω}];


(suitable parameters are $E_1=-1$, $E_2=-1/2$, $\mu=0.1$, $\omega=0.05$)

but this simply causes an error

NDSolve::ndnl: "Endpoint 0. +125.664\ I in {t,0.,0. +125.664\ I} is not a real number"


I have looked online but I haven't found any good resources. Is this functionality natively available in Mathematica? Are there easily available add-ons that provide it? Or will I need to manually convert the ODEs into a chain of equations of a real variable?

• You may need to just change the variable t to s=t/I so that it is a real parameter. I think the adjusted equations, with imaginary parts, should not pose a problem for NDSolve. That is to say, coefficients can be complex (I think). – Daniel Lichtblau Aug 31 '14 at 13:39
• @DanielLichtblau That is possible, though the path is more complicated (i.e. a number of segments at different angles, and not normally at 90°). I was hoping for the kind of iterator notation used in NIntegrate, e.g. NIntegrate[f,{x,x0,x1,…,xk}]. – Emilio Pisanty Aug 31 '14 at 15:57
• Well, you can also change the variable to $s = t/z_0$ for any fixed complex $z_0$ and still have a real independent variable $s$ to use... would that help? It's still a linear change of variables, you could automate the change of variables in Mathematica (probably even with $z_0$ left unspecified), and that would probably get NDSolve working. It would have to be straight lines though (you say "a number of line segments..")? – Kellen Myers Aug 31 '14 at 16:29