# Numerically solve complex differential equation

I'd like to find a numerical solution to a complex differential equation of the form $\frac{dz(t)}{dt} = f(z,t)$, where $z$ and $t$ can both be complex, with $z(0)=0$. Specifically, I'd like to determine values of $z$ for some mesh of values of $(t_r,t_c)$, where $t = t_r + t_c i$, so that I can potentially interpolate later to find $z(t)$ at any complex $t$.

One approach would be to numerically solve the ODE for real $t$, find a smooth approximation to the solution (e.g. a polynomial), and then analytically continue the smooth function into the complex plane. I'm worried about the accuracy of this approach, because I don't know if the smooth function being an accurate approximation on the real axis guarantees its accuracy in other parts of the complex plane. I could also consider solving the ODE for imaginary $t$, or along any particular curve through the plane, and then analytically continue it similarly - which would at least provide consistency tests.

But perhaps I should be thinking of it as a PDE rather than an ODE - I can write $\frac{\partial z}{\partial t_r} = -i \frac{\partial z}{\partial t_c} = f(z,t_r,t_c)$, but then it looks like I've got too many constraints for a usual PDE solver...

Is there a more natural way to solve these types of equations numerically?

• Well, the most natural approach to solving this would be Taylor series, especially since they are the main tool for analytical continuation. You could consider the Taylor series around one of your grid points, calculate the coefficients (estimating the radius of convergence), calculationg the new starting values at a neighboring grid point, and so on. No, there's no problem if your $f$ is a composition of elementary functions, as I tried to explain here.
– user436658
Commented Jan 18, 2018 at 20:36
• What is the intent of the analytical continuation ? If you hope to extrapolate from the numerical solution, you'd better continue with the numerical solver.
– user65203
Commented Jan 19, 2018 at 17:15

Any n dimensional ODE system in $\mathbb{C}$ can be described as an 2n dimensional ODE system in $\mathbb{R}$. $z(t)=\operatorname{Re}(z) +i\operatorname{Im}(z)$ and $t=\operatorname{Re}(t) +i\operatorname{Im}(t)$

thus

$\frac{d\operatorname{Re}(z(t))}{d\operatorname{Re}(t)}=\operatorname{Re}(f(z,t))$

$\frac{d\operatorname{Im}(z(t))}{d\operatorname{Im}(t)}=\operatorname{Im}(f(z,t))$

The inital condition $z(0)=0$ results in $\operatorname{Re}(z(0))=0$ and $\operatorname{Im}(z(0))=0$.

Now you have two ODE and two initial conditions, you can solve this with Runge–Kutta methods.

Afterwards you can reconstruct $z(t)=\operatorname{Re}(z(t))+ i\operatorname{Im}(z(t))$.

• There is no real need to split in real and imaginary parts, all computations can be made in the complex.
– user65203
Commented Jan 19, 2018 at 17:14
• So these are PDEs now right? Because there's two different time variables $Im (t)$ and $Re (t)$? Commented Jan 19, 2018 at 22:35
• $\frac{\partial u}{\partial t} = h^2 \left( \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2} \right)$ is a PDE since you have in one equation u derived wrt x and u derived wrt y, however in the above example you have two ODE Commented Jan 20, 2018 at 17:05

given $df/dz=f(z,t)$ you can simply construct coupled ODE such that by parametrizing $t$ using $x$ as $$t (\in \mathbb{C} ) = \begin{cases} \mathrm{Re}\{ t\} = t_r = p(x) \\ \mathrm{Im}\{t\} = t_i = q(x) \end{cases}$$ where $x \in \mathbb{R}$. use the rules of PDE, you can write $$\frac{\partial f}{\partial t_r}\frac{d t_r}{d x} + \frac{\partial f}{\partial t_i}\frac{d t_i}{d x} = f(t)$$ you can now use Cauchy-Riemann relation to get rid of one of the partial derivatives to get a sensible ODE.

Or even, if you are going vertical or horizontal in a complex plane, then I think you can get rid of $t_i/dx$ by setting $x = t_r$ and $t_i = \mathrm{Const}$ (and vice versa).

If that's done, just use commercial ODE solver.

• sensible ODE. May be PDE not ODE.
– Tom
Commented Jan 20, 2018 at 13:19

This is more of an opinion than a mathematical solution. In my experience, I have never gone wrong when treating complex numbers exactly like real numbers. What I'm saying is that I would solve the problem exactly as you pose it. Of course, in order to do that you must have a programming language that treats complex variables seamlessly, such as Matlab.