Evaluating exponential integral

886 Views Asked by At

I am struggling for some time to solve the following integral:

$$ \int_{-n}^{N-n} \left( \frac{e^{-j\pi(\alpha-1)\tau}}{\tau} - \frac{e^{-j\pi(\alpha+1)\tau}}{\tau} \right) d\tau $$

$N$ is a positive integer, $n$ is an integer, $\alpha$ can be a negative or positive rational number.

I want to express it analytically using exponential integrals $E_1(z)$:

$$ \mathrm{E}_1(z) = \int_z^\infty \frac{e^{-t}}{t}\, dt,\qquad|{\rm Arg}(z)|<\pi $$

I am afraid to split the integral because it is not well defined around $\tau=0$.

I tried lots of stuff, in particular using a limit before the integral and approaching zero with it, and substitute for $E_1(z)$.

I compare my analytical results (using values from $E_1(z)$ in MATLAB) against a numerical evaluation in MATLAB.

It works out for approximately half of my values but the rest is different by absolute values of exactly 1 or 0.5. Sometimes I even get NaN (undefined) values because $\alpha$ will be -1 and 1 at some point and $n$ will be zero at some point. Still, practically this makes no sense and should not happen (it does not happen with the numerical integration too).

In my opinion, the result should be $$ E_1(i\pi(\alpha-1)n) - E_1(-i\pi(\alpha-1)(N-n)) - E_1(-i\pi(\alpha+1)n) + E_1(-i\pi(\alpha+1)(N-n)) $$

In order to match the results with my numerical integration, I split the integration and leave out the problematic zero ($\epsilon\rightarrow 0$):

$$ E_1(i\pi(\alpha-1)n) - E_1(-i\pi(\alpha-1)\epsilon) + E_1(i\pi(\alpha-1)\epsilon) - E_1(-i\pi(\alpha-1)(N-n)) -E_1(-i\pi(\alpha+1)n)+E_1(-i\pi(\alpha+1)\epsilon)-E_1(i\pi(\alpha+1)\epsilon)+E_1(-i\pi(\alpha+1)(N-n)) $$

I would expect $- E_1(-i\pi(\alpha-1)\epsilon) + E_1(i\pi(\alpha-1)\epsilon)$ and $E_1(-i\pi(\alpha+1)\epsilon)-E_1(i\pi(\alpha+1)\epsilon)$ to be zero but depending on $n$, they are $\pm i\pi$ which ultimately result in the wrong result.

So it seems I need to take special care around the singularity ... but what do I need to change?

2

There are 2 best solutions below

3
On

Here is an approach. Expand the exponential functions in terms of their Taylor series and note that constant terms cancel each other so we have

$$I= \int_{-n}^{N-n} \left( \frac{e^{j\pi\alpha\tau}}{\tau} - \frac{e^{j\pi\beta\tau}}{\tau} \right) d\tau = \sum_{k=1}^{\infty}\frac{(j\pi\alpha)^k-(j\pi\beta)^k}{k!} \int_{-n}^{N-n}\tau^{k-1}=\dots $$

$$ I= -{\it E}_1 \left( -\alpha\,\pi \,j \left( N-n \right) \right) +{\it E}_1 \left( -\pi \,j\beta\, \left( N-n \right) \right) +{\it E}_1 \left( 1,\alpha\,j\pi \,n \right) -{\it E}_1 \left( 1,\pi \,\beta\,jn\right) ,$$

where $\it E_1 $ is the exponential integral. Also you can have a solution in terms of the upper incomplete gamma function

$$ I = -\Gamma(0, -\alpha \pi j (N-n))+\Gamma(0, -\pi j \beta (N-n))+\Gamma(0, \alpha j \pi n)- \Gamma(0, \pi \beta j n).$$

1
On

If you prefer a closed form with functions without $i$ in the argument, better use the functions Ci($x$) and Si($x):

http://mathworld.wolfram.com/CosineIntegral.html http://mathworld.wolfram.com/SineIntegral.html

$$ \int_{-n}^{N-n} \left( \frac{e^{j\pi\alpha\tau}}{\tau} - \frac{e^{j\pi\beta\tau}}{\tau} \right) d\tau=\int_{-n}^{N-n} \frac{(\cos(\pi\alpha\tau)-\cos(\pi\beta\tau))+i(\sin(\pi\alpha\tau)-\sin(\pi\beta\tau))}{\tau} d\tau $$ $$ \int_{-n}^{N-n} \left( \frac{e^{j\pi\alpha\tau}}{\tau} - \frac{e^{j\pi\beta\tau}}{\tau} \right) d\tau=\text{Ci}\big((N-n)\pi\alpha\big)-\text{Ci}(n\pi\alpha)-\text{Ci}\big((N-n)\pi\beta\big)+\text{Ci}(n\pi\beta)+i\big(\text{Si}\big((N-n)\pi\alpha\big)+\text{Si}(n\pi\alpha)-\text{Si}\big((N-n)\pi\beta\big)-\text{Si}(n\pi\beta)\big) $$