Calculating $\int e^{-|x|} \, dx$. I have been trying to calculate
$\int e^{|x|} \, dx$, but merely splitting up in two cases for $x<0$ and $x>0$ does not give the desired result, which I got by calculating it on a CAS. 
Suggestions would be very welcome.
Edit.
I made a mistake. It's $\int e^{-|x|} \, dx$. 
 A: Using $$\exp(|x|) =\begin{cases} \exp(x) & x \geqslant 0 \\ \exp(-x) & x < 0 \end{cases} $$
we can integrate branch-wise:
$$
   \int \exp(|x|) \mathrm{d}x = \begin{cases} \int \exp(x) \mathrm{d}x & x \geqslant 0 \\ \int \exp(-x) \mathrm{d}x & x < 0 \end{cases} = \begin{cases} \exp(x) + C_1 & x \geqslant 0 \\ -\exp(-x) + C_2 & x < 0 \end{cases}
$$
A: The primitive that people seem to want to give is
$$
\mathrm{sign}(x)\left(e^{|x|}-1\right)+C
$$
Another way of writing this is
$$
\mathrm{sign}(x)\left(e^{|x|}-1\right)+C=\left\{\begin{array}{}
e^x-1+C&\text{if }x\ge0\\
1-e^{-x}+C&\text{if }x\lt0\\
\end{array}\right.
$$
which is continuous at $x=0$ and whose derivative is $e^{|x|}$ otherwise.
A: You can determine a primitive $F(x)$ by integrating with a fixed lower bound, say $0$; for $x\ge0$ we have
$$
F(x)=\int_{0}^x e^{-|t|}\,dt=\int_{0}^x e^{-t}\,dt=\Bigl[-e^{-t}\Bigr]_0^x=1-e^{-x}
$$
For $x\le0$ we have
$$
F(x)=\int_{0}^x e^{-|t|}\,dt=\int_{0}^x e^{t}\,dt=\Bigl[e^{t}\Bigr]_0^x=e^x-1
$$
Now you can incorporate the arbitrary constant of integration, getting
$$
\begin{cases}
-e^{-x}+1+C & \text{for $x\ge0$}\\
e^x-1+C & \text{for $x<0$}
\end{cases}
$$
which can also be written, since $C$ is arbitrary,
$$
\begin{cases}
-e^{-x}+C & \text{for $x\ge0$}\\
e^x-2+C & \text{for $x<0$}
\end{cases}
$$
A: we can also write
$$\int e^{|x|} dx= sign(x) e^{|x|}+C$$
