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?