<s>[INST] $\lim_{ x \to 0 } \frac{e-(1+\arctan x)^{\frac{1}{x}}}{x}$ I have to evaluate this limit:
$$\lim_{ x \to 0 }  \frac{e-(1+\arctan x)^{\frac{1}{x}}}{x}$$
I have an indeterminated form $[\frac{0}{0}]$.
So I applied the Hopital rule
$$\frac{e-(1+\arctan x)^{\frac{1}{x}}}{x} \sim $$
$$-e^{\frac{\log(1+\arctan x)}{x}} \cdot \frac{\frac{x}{(1+\arctan x)(1+x^2)}-\log(1+\arctan x)}{x^2} \sim$$
$$ -e \cdot \frac{1}{x^2} \cdot \left(\frac{x}{(1+x)(1+x^2)}-x\right)
\sim +e $$
According to my book and wolfram alpha the final result should be $\frac{e}{2}$ and I don't know where I made mistakes.
 [/INST] You can avoid the exponentials by a simple trick using the standard limit $\lim_{y\to 0}\frac{e^y-1}y=1$.
\begin{eqnarray*}\frac{e-(1+\arctan x)^{\frac{1}{x}}}{x}
& = & e\cdot \frac{\left(1-e^{\frac{\ln(1+\arctan x)-x}{x}}\right)}{x}\\
& \stackrel{y=\frac{\ln(1+\arctan x)-x}{x}}{=} & e\cdot \underbrace{\frac{1-e^y}y}_{\stackrel{x\to 0}{\longrightarrow}-1}\cdot \frac{\ln(1+\arctan x)-x}{x^2}
\end{eqnarray*}
Here I use that $\lim_{x\to 0}\frac{\ln(1+\arctan x)-x}{x} =0$, which can quickly be shown by L'Hospital.
Now, we only have to deal with
\begin{eqnarray*}\frac{\ln(1+\arctan x)-x}{x^2}
& \stackrel{L'Hosp.}{\sim} & \underbrace{\frac 1{(1+x^2)(1+\arctan x)}}_{\stackrel{x\to 0}{\longrightarrow}1}\cdot \frac{1-(1+\arctan x)(1+x^2)}{2x}
\end{eqnarray*}
Finally,
\begin{eqnarray*}\frac{1-(1+\arctan x)(1+x^2)}{2x}
& \stackrel{L'Hosp.}{\sim} & \frac{-(1+\arctan x)2x-(1+x^2)\frac 1{1+x^2}}{2}\\
& \stackrel{x\to 0}{\longrightarrow} & -\frac 12\\
\end{eqnarray*}
All together
$$\frac{e-(1+\arctan x)^{\frac{1}{x}}}{x} \stackrel{x\to 0}{\longrightarrow} e\cdot (-1) \cdot \left(-\frac 12\right) = \frac e2 $$
</s>