How should one numerically integrate a complex exponential function like

$$\int \frac{e^{-ikt}}{\sqrt{1+it}} dt$$

where it is not obvious how to separate the real and imaginary parts of integrand?

Using Euler's formula:

$$ \sum \frac{\cos (kt) - i \sin (kt)}{\sqrt{1+it}} \Delta t$$

seems to require us, first of all, to be able to separate (eg. this integral) the real and imaginary parts cleanly before applying numerical integration?

  • 1
    $\begingroup$ Numerically integrate over what domain? $\endgroup$
    – K.defaoite
    May 9 at 0:26
  • 2
    $\begingroup$ If $\lambda$ is just a constant, then remove the denominator: the integral is $1/(1+i\lambda)\int e^{-ikt}\,dt$. You know how to integrate $e^{-ikt}$ with respect to $t$, yes? $\endgroup$
    – KCd
    May 9 at 0:37
  • 4
    $\begingroup$ It's not a theorem, that is quite literally the definition of a complex number $\endgroup$
    – K.defaoite
    May 9 at 0:43
  • 1
    $\begingroup$ In general, for a function $\int g(t)\,dt$, one can numerically evaluate $g(t)$ (for reasonably well-behaved $g$), then split into real and complex parts, and integrate each part separately before adding. For the example you linked to, it might be tricky to explicitly reduce that into $a+bi$ form, but since you're numerically integrating, you could just find $\frac{1}{\sqrt{1+2it}}$ and $e^{2i\frac{x-t+tx^2}{1+4t^2}-\frac{(x-2t)^2}{1+4t^2}}$ and multiply them. $\endgroup$
    – Kyky
    May 9 at 1:38
  • 2
    $\begingroup$ If you're trying to evaluate the indefinite integral $$\int \frac{e^{-i k t}}{\sqrt{1+i t}}\, dt$$ then you can make the substitution $t=-i s$ (so $dt=-i\, ds$ and $s=i t$) and evaluate $$-i\int \frac{e^{-k s}}{\sqrt{1+s}}\, ds$$ and then substitute $s=i t$ into the result to get back to a function of $t$. If you're trying to evaluate a definite integral then you need to specify the evaluation limits which could be real or complex. $\endgroup$ May 9 at 1:54

1 Answer 1


Let $$\sqrt{1+it}=a+ib$$

where $a=a(t), b=b(t)$ are real functions.

Square it, we get $$1+it=a^2-b^2+2abi$$

Compare the real and imaginary part, we get


Solve and we get


$$$$ Therefore,

$$\begin{align}\frac{1}{\sqrt{1+it}}&=\frac{1}{a+ib}=\frac{a-ib}{a^2+b^2}\\ \\ &=\frac{1}{\sqrt{1+t^2}}\sqrt{\frac{1+\sqrt{1+t^2}}{2}}-i\frac{1}{\sqrt{1+t^2}}\sqrt{\frac{-1+\sqrt{1+t^2}}{2}}\end{align}$$


$$\begin{align}\frac{e^{-ikt}}{\sqrt{1+it}}&=\left(\sqrt{\frac{1+\sqrt{1+t^2}}{2(1+t^2)}}-i\sqrt{\frac{-1+\sqrt{1+t^2}}{2(1+t^2)}}\right)(\cos kt-i\sin kt)\\ \\ &=R(t)+i\cdot I(t)\end{align}$$


$$\begin{align}R(t)&=\cos kt\cdot\sqrt{\frac{1+\sqrt{1+t^2}}{2(1+t^2)}}-\sin kt\cdot\sqrt{\frac{-1+\sqrt{1+t^2}}{2(1+t^2)}}\\ \\ I(t)&=-\cos kt\cdot\sqrt{\frac{-1+\sqrt{1+t^2}}{2(1+t^2)}}-\sin kt \cdot\sqrt{\frac{1+\sqrt{1+t^2}}{2(1+t^2)}}\end{align}$$

Hence, your integral becomes:

$$\int \frac{e^{-ikt}}{\sqrt{1+it}} dt=\int R(t) dt+i\int I(t) dt$$

Now you can do the numerical integration on these two real integrals.

  • $\begingroup$ For complex numbers $\sqrt{a}\sqrt{b} \neq \sqrt{ab}$ so that throws your premise off. $\endgroup$ May 9 at 1:46
  • $\begingroup$ $a,b$ are real functions @NinadMunshi $\endgroup$
    – MathFail
    May 9 at 1:48
  • $\begingroup$ You misunderstand, I mean your first step where you claim $$\frac{1}{\sqrt{1+it}}\cdot \frac{\sqrt{1-it}}{\sqrt{1-it}} = \frac{\sqrt{1-it}}{\sqrt{1+t^2}}$$ (which actually reveals a second mistake in your first line). We cannot claim that equality because of the lack of that property of being able to combine products of square roots. $\endgroup$ May 9 at 1:51
  • 1
    $\begingroup$ You can treat them as $$\frac{1}{\sqrt{1-it}}=\frac{1}{a+ib}=\frac{a-ib}{a^2+b^2}$$, so it can save some typing work. @NinadMunshi $\endgroup$
    – MathFail
    May 9 at 1:54
  • 1
    $\begingroup$ You are welcome, I remember answered you another numerical integral question a few hours ago :) @James $\endgroup$
    – MathFail
    May 9 at 2:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .