Derivative of $\left(\frac{\sqrt{8|x|}\sin^2 x}{\cos x}\right)^{\operatorname{erf}(x)}$ I'm trying to find the derivative of $$\left(\frac{\sqrt{8|x|}\sin^2 x}{\cos x}\right)^{\operatorname{erf}(x)}$$ so I can find its local minima at the interval $[0,0.5]$ and $[0,-0.5]$. How do I differentiate something like this? Is it possible to find the derivative of each part separately and then combine them again?
 A: Your function is:
$$\left(\frac{\sqrt{8 \left| x\right| } \sin ^2(x)}{\cos (x)}\right)^{\text{erf}(x)}=2^{\frac{3 \text{erf}(x)}{2}} \left| x\right| ^{\frac{\text{erf}(x)}{2}} (\sin (x) \tan (x))^{\text{erf}(x)}$$
As Bernard Masse correctly pointed out, using a CAS is efficient here. I tried the following using Mathematica:
FullSimplify[D[(Sqrt[8 Abs[x]]*Sin[x]^2/Cos[x])^Erf[x], x]];

As a result I obtained:
$$\frac{1}{\sqrt{\pi }}e^{-x^2} 2^{\frac{3 \text{erf}(x)}{2}-1} \left| x\right| ^{\frac{\text{erf}(x)}{2}-1}\\ \cdot(\sin (x) \tan (x))^{\text{erf}(x)} \left(\sqrt{\pi } e^{x^2} \text{erf}(x)\\ \cdot\left(\text{Abs}'(x)+2 \left| x\right|  (\tan (x)+2 \cot (x))\right)+2 \left| x\right|  (\log (8 \left| x\right| )+2 \log (\sin (x) \tan (x)))\right)$$
The plot of your original function is, where the blue curve represents the real part and the orange one the imaginary part:

And your derivative looks as follows:

A: As I mentioned in my linked answer, to take derivatives of expressions of the form $y(x)=f(x)^{g(x)}$ we write
$$\log y(x)=g(x)\log f(x)$$
Use the chain rule and the product rule,
$$\frac{y'(x)}{y(x)}=g'(x)\log f(x)+\frac{f'(x)}{f(x)}g(x)$$
So
$$y'(x)=f(x)^{g(x)}\left(g'(x)\log f(x)+\frac{f'(x)}{f(x)}g(x)\right)$$
