<s>[INST] Find $\lim_{x\to0}\frac{(\tan(\frac{\pi}{4}+x))^{\frac{1}{x}}-e^2}{x^2}$ Find $\lim_{x\to0}\frac{(\tan(\frac{\pi}{4}+x))^{\frac{1}{x}}-e^2}{x^2}$

My attempt:
$\lim_{x\to0}(\tan(\frac{\pi}{4}+x))^{\frac{1}{x}}=e^2$
So the required limit is in $\frac{0}{0}$ form.
Then i used L hospital form.
$\lim_{x\to0}\frac{e^2(\frac{2}{x\cos 2x}-\frac{1}{x^2}\log(\frac{1+\tan x}{1-\tan x}))}{2x}$
I am stuck here.
 [/INST] In the same spirit as Olivier Oloa's answer.
By Taylor $$\tan(\frac{\pi}{4}+x))=1+2 x+2 x^2+\frac{8 x^3}{3}+\frac{10 x^4}{3}+\frac{64 x^5}{15}+O\left(x^6\right)$$ $$\log\Big(\tan(\frac{\pi}{4}+x)) \Big)=2 x+\frac{4 x^3}{3}+\frac{4 x^5}{3}+O\left(x^6\right)$$ $$\frac 1x\log\Big(\tan(\frac{\pi}{4}+x)) \Big)=2+\frac{4 x^2}{3}+\frac{4 x^4}{3}+O\left(x^5\right)$$ $$\exp\Big(\frac 1x\log\Big(\tan(\frac{\pi}{4}+x)) \Big)\Big)=\Big(\tan(\frac{\pi}{4}+x)) \Big)^{\frac 1x}=e^2+\frac{4 e^2 x^2}{3}+\frac{20 e^2 x^4}{9}+O\left(x^5\right)$$ $$\frac{(\tan(\frac{\pi}{4}+x))^{\frac{1}{x}}-e^2}{x^2}=\frac{4 e^2}{3}+\frac{20 e^2 x^2}{9}+O\left(x^3\right)$$ which shows the limit and how it is approached.
To show how good is the approximation : using $x=\frac 1{10}$, the expression is $\approx 10.0191$ while the approximation gives $\frac{61 e^2}{45}\approx 10.0163$ that is to say a relative error of less than $0.03$%.
</s>