I am studying special function, in particular the Exponential Integral, and I came up with this integral:
$$\int_{-3}^3 \frac{e^{i ax}}{x}\ \text{d}x$$
Now, I understood that this integral does not converge since it crosses the point $0$. I tried then to solve it in terms of principal value, setting
$$\lim_{\epsilon \to 0} \int_{-3}^{-\epsilon} + \int_{\epsilon}^3 $$
Then I tought the result would just be $Ei(-3 i a) - Ei(3 i a)$, since $$\lim_{\epsilon \to 0} Ei(-\epsilon) - Ei(\epsilon) = 0 $$
Yet W. Mathematical tells me the result is
$$\frac{1}{2} \left(-2 \text{Ei}(-3 i a)+2 \text{Ei}(3 i a)-\log \left(\frac{i}{a}\right)+\log \left(-\frac{i}{a}\right)+\log (-i a)-\log (i a)\right)$$
So now I am asking:
Where do the log terms come from?
Why are there those "2"s constants?
Add to your code
and the result will be
$$\int_{-3}^{+3} \frac{e^{i ax}}{x}\,dx=2\,i\, \text{Si}(3 a)$$