TITLE: What to do to calculate $\int_{-\pi/4}^{+\pi/4}e^{-\tan\theta}\mathrm{d}\theta$
QUESTION [5 upvotes]: I have to calculate the following integral:
$$A=\int_{-\pi/4}^{+\pi/4}e^{-\tan\theta}\mathrm{d}\theta.$$
What I did:
Let $t=\tan\theta$. Thus, $\dfrac{\mathrm{d}t}{\mathrm{d}\theta}=1+\tan^2\theta=1+t^2.$
Therefore, 
$$A=\int_{-1}^{+1}\dfrac{e^{-t}}{1+t^2}\mathrm{d}t.$$
Now, I write $\dfrac{1}{1+t^2}=\sum\limits_{k=0}^{\infty}(-t^2)^k.$
And therefore, $$A=\int_{-1}^{+1}\sum\limits_{k=0}^{\infty}(-1)^k t^{2k}e^{-t}\mathrm{d}t.$$
What to do now?
Also, what to do to calculate $$B=\int_{\pi/4}^{\pi/2}e^{-\tan\theta}\mathrm{d}\theta.$$
Should I do the same as the previous case?

Thanks.

REPLY [2 votes]: Another approach using Laplace transforms.
\begin{eqnarray*}
A(x) &=&\int_{-1}^{+1}dt\frac{\exp [-xt]}{1+t^{2}} \\
\partial _{x}A(x) &=&\int_{-1}^{+1}dt\frac{-t}{1+t^{2}}\exp [-xt] \\
\partial _{x}^{2}A(x) &=&\int_{-1}^{+1}dt\frac{t^{2}}{1+t^{2}}\exp [-xt] \\
&=&\int_{-1}^{+1}dt\frac{1+t^{2}-1}{1+t^{2}}\exp [-xt]=\int_{-1}^{+1}dt\exp
[-xt]-A(x) \\
&=&\frac{\exp [+x]-\exp [-x]}{x}-A(x)=\frac{2\sinh x}{x}
\end{eqnarray*}
\begin{eqnarray*}
\partial _{x}^{2}A(x)+A(x) &=&\int_{-1}^{+1}dt\exp [-xt] \\
A(0) &=&\int_{-1}^{+1}dt\frac{1}{1+t^{2}} \\
(\partial _{x}A)(0) &=&\int_{-1}^{+1}dt\frac{t}{1+t^{2}}=0
\end{eqnarray*}
Complex Laplace transform ($\Gamma $ is a straight line above and parallel
to the real axis)
\begin{eqnarray*}
\hat{f}(z) &=&\int_{0}^{\infty }dx\exp [izx]f(x),\mathrm{{Im}}z>0 \\
f(x) &=&\frac{1}{2\pi }\int_{\Gamma }dz\exp [-izx]\hat{f}(z)
\end{eqnarray*}
We have, noting that $(\partial _{x}A)(0)=0$,
\begin{eqnarray*}
\int_{0}^{\infty }dt\exp [izx]\int_{-1}^{+1}dt\exp [-xt] &=&\int_{-1}^{+1}dt%
\frac{1}{t-iz} \\
\int_{0}^{\infty }dt\exp [izx]\partial _{x}^{2}A(x) &=&izA(0)-z^{2}\hat{A}(z)
\end{eqnarray*}
so
\begin{eqnarray*}
izA(0)-(z^{2}-1)\hat{A}(z) &=&\int_{-1}^{+1}dt\frac{1}{t-iz} \\
\hat{A}(z) &=&\frac{iz}{z^{2}-1}A(0)-\int_{-1}^{+1}dt\frac{1}{z^{2}-1}\frac{1%
}{t-iz}
\end{eqnarray*}
and
\begin{eqnarray*}
A(x) &=&\frac{1}{2\pi }\int_{\Gamma }dz\exp [-izx]\{\frac{iz}{z^{2}-1}%
A(0)-\int_{-1}^{+1}dt\frac{1}{z^{2}-1}\frac{1}{t-iz}\} \\
&=&\frac{1}{2\pi i}\int_{\Gamma }dz\exp [-izx]\{-\frac{z}{z^{2}-1}%
A(0)+\int_{-1}^{+1}dt\frac{1}{z^{2}-1}\frac{1}{z+it}\}
\end{eqnarray*}
Continuing analytically in the lower half plane we encounter poles in $z=\pm
1$ and $z=-it$ (the latter is in the upper half plane for negative $t$,
sufficiently large) and obtain $A(x)$ in terms of residues.