Integral of $e^{|x|}$ I was wondering how to take the indefinite integral of $e^{|x|}$; Wolfram gave me a complicated expression with a signum function, and I wasn't completely sure how to reproduce this result. Thanks. 
 A: You would need this to be definite to evaluate, i.e. if $a<0<b$ we have 
$$
\int_a^be^{|x|}dx=\int_a^0e^{-x}dx+\int_0^be^xdx
$$
and similarly by cases for intervals of the form $a<b<0$ etc.
A: It suffices to find a particular primitive of your function. The fact is that  $e^{|x|}$ is special around $x=0$, so we may try to find our primitive by integrating from $0$.
$$
F(x)=\int_0^x e^{|t|}\, \mathrm{d}t=\int_0^x e^{t}\, \mathrm{d}t=e^x-1\qquad (x>0)\\
F(x)=\int_0^x e^{|t|}\, \mathrm{d}t=\int_0^x e^{-t}\, \mathrm{d}t=-e^{-x}+1\qquad (x<0)
$$
Combining we arrive at the following,
$$
F(x)=
\begin{cases}
e^x-1 & x>0\\
-e^{-x}+1 & x<0
\end{cases}
$$
With some thought this can be converted into a single equation.
$$
F(x)=\mathrm{sgn}(x)(e^{|x|}-1)
$$
The general solution follows by adding an arbitrary constant.
As to how Wolfram got its particular result, I'm not sure, but I can show  that it is equivalent.
$$
\begin{align*}
\frac{1}{2}e^{-x}\left((e^x-1)^2\mathrm{sgn}(x)-2e^x+e^{2x}-1\right)
&=\frac{1}{2}\left((e^x-2+e^{-x})\mathrm{sgn}(x)-2+e^{x}-e^{-x}\right)\\
&=\frac{1}{2}\left((e^x-2+e^{-x})\mathrm{sgn}(x)-2+e^{x}+e^{-x}-2e^{-x}\right)\\
&=\frac{1}{2}(e^x-2+e^{-x})(\mathrm{sgn}(x)+1)-e^{-x}
\end{align*}
$$
Now when $x>0$ we get $\mathrm{sgn}(x)+1=2$ so
$$
\frac{1}{2}(e^x-2+e^{-x})(\mathrm{sgn}(x)+1)-e^{-x}=e^x-2+e^{-x}-e^{-x}=e^x-2
$$
And when $x<0$ we get $\mathrm{sgn}(x)+1=0$ so
$$
\frac{1}{2}(e^x-2+e^{-x})(\mathrm{sgn}(x)+1)-e^{-x}=-e^{-x}
$$
But this is just our previous result shifted by a constant.
A: It is recommended you split your integral to avoid such complexities:
$$\begin{align}\int_a^be^{|x|}\ dx&=\int_a^0e^{|x|}\ dx+\int_0^be^{|x|}\ dx\\&=\int_a^0e^{-x}\ dx+\int_0^be^x\ dx\\&=-e^{-x}\bigg|_a^0+e^x\bigg|_0^b\\&=e^{-a}+e^b-2\end{align}$$
Assuming that $a<0$ and $b>0$.  Feel free to adjust for different cases, such as $a>0$ and $b>0$.
