My goal is to take a complex-differentiable function $f:\Bbb C\rightarrow\Bbb C$ and a value $z$ and approximate $F(z)$, where $F$ is one of the functions such that $F^\prime(z)=f(z)$ for all $z$. Now, if $f$ was a real function, this would be simple; one could just take $$F(x)=\begin{cases}\int_0^xf(x)\,\text dx,&\text{if $x\geq0$}\\-\int_x^0f(x)\,\text dx,&\text{if $x<0$}\end{cases}$$ and use standard numerical quadrature.

However, this doesn't appear to apply at all on the complex plane. First off, "the signed area under the curve" definition of a definite integral doesn't appear to apply even for a function $f:\Bbb R\rightarrow\Bbb C$; I'd guess that one should just add the complex numbers, but I cannot find any preexisting methods of numerical quadrature for functions of this type. Secondly, I'm not sure which definite integral I would have to take for a specific value of $z$. I've read something about path integrals and contours, but I do not see how they would apply here. Over all, my question is: how would I go about approximating values of the complex antiderivative?


I assume all you know about $f$ is that it is complex-differentiable and you can evaluate it at a point.

Since $f$ is complex-differentiable it can be expressed as a power series \begin{align*} f(z) = \sum_{n=0}^{\infty} \frac{f^{(n)}(z_{0})}{n!}(z - z_{0})^{n} \end{align*} Integrating term by term we have \begin{align*} F(z) = C + \sum_{n=0}^{\infty} \frac{f^{(n)}(z_{0})}{(n+1)!}(z - z_{0})^{n+1} \end{align*} So all you need is a numerical algorithm to evaluate $f^{(n)}(z_{0})$ for sufficiently many $n$. Using Cauchy's differentiation formula \begin{align*} f^{(n)}(z_{0}) = \frac{n!}{2\pi i} \oint \frac{f(z)}{(z-z_{0})^{n+1}} \, \mathrm{d}z = \frac{n!}{r^{n}} \int_{0}^{1} f(z_{0} + re^{2\pi i\theta})e^{-2\pi in\theta} \, \mathrm{d}\theta \end{align*} where $r$ is sufficiently small to not enclose any poles of $f$. A necessary condition on $r$ is that \begin{align*} \oint f(z) \, \mathrm{d}z = \int_{0}^{1} f(z_{0} + re^{2\pi i\theta}) \, \mathrm{d}\theta = 0 \end{align*} which follows from the residue theorem. In rare cases there could be pole cancellation, so you might also want to assert that the identity \begin{align*} f(z_{0}) = \frac{1}{2\pi i} \oint \frac{f(z)}{z - z_{0}} \, \mathrm{d}z \end{align*} holds. In order for both these tests to pass, not only do the poles have to cancel, they have to solve a linear system, so if you choose an $r$ where both these identities hold you are almost certainly in the clear.

Since the integrands are periodic, simple trapezoidal quadrature converges exponentially and computing $n$ integrands is little more work than computing 1. This is because once we've computed a sample $f_{k} := f(z_{0} + re^{2\pi i\theta_{k}})$, then we just store that value and get the rest of the integrals just by repeated multiplications by $e^{-2\pi i\theta_{k}}$. Expect about 30 calls to $f$ to obtain double precision.

This is riffing off the ideas of Lyness and Moler who recognized that numerical differentiation by contour integration is numerically stable and fast. They weren't interested in complex antidifferentiation, but nonetheless the idea seems to apply here.

  • $\begingroup$ Luckily, I don't think the users will be trying to trick the system in my use case :P $\endgroup$ – LegionMammal978 Apr 6 '17 at 20:43
  • $\begingroup$ @LegionMammal978: What's your application for this? $\endgroup$ – user14717 Apr 7 '17 at 17:20
  • $\begingroup$ Literally a numerical antiderivative function in a system that supports complex numbers (also, what do you mean by the repeated multiplication bit?) $\endgroup$ – LegionMammal978 Apr 7 '17 at 17:25
  • $\begingroup$ @LegionMammal978: Is it open source? $\endgroup$ – user14717 Apr 7 '17 at 17:26
  • $\begingroup$ So far, a) it's an early work in progress, b) it's on my local computer, and c) I'm just starting to implement this. $\endgroup$ – LegionMammal978 Apr 7 '17 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.