# How to integrate $\int \frac{e^{-ikt}}{\sqrt{1+it}}\,dt$ numerically?

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?

• Numerically integrate over what domain? May 9 at 0:26
• 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?
– KCd
May 9 at 0:37
• It's not a theorem, that is quite literally the definition of a complex number May 9 at 0:43
• 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.
– Kyky
May 9 at 1:38
• 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. May 9 at 1:54

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

$$1=a^2-b^2,~~~t=2ab$$

Solve and we get

$$a=\sqrt{\frac{1+\sqrt{1+t^2}}{2}},~~b=\sqrt{\frac{-1+\sqrt{1+t^2}}{2}}$$

 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}

Further,

\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}

where

\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}

$$\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.

• For complex numbers $\sqrt{a}\sqrt{b} \neq \sqrt{ab}$ so that throws your premise off. May 9 at 1:46
• $a,b$ are real functions @NinadMunshi May 9 at 1:48
• 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. May 9 at 1:51
• 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 May 9 at 1:54
• You are welcome, I remember answered you another numerical integral question a few hours ago :) @James May 9 at 2:42