<s>[INST] Evaluating $I=\int\frac{\sin(x)+\cos(x)}{\sin^4(x)+\cos^2(x)}~dx$ I'm interested in the following problem:

Evaluate the indefinite integral$$I=\int\frac{\sin(x)+\cos(x)}{\sin^4(x)+\cos^2(x)}~dx$$

Here's what I did:
We note that
$$I = \int\frac{\sin(x)}{\sin^4(x)+\cos^2(x)}~dx+\int\frac{\cos(x)}{\sin^4(x)+\cos^2(x)}~dx$$Now we evaluate each part separately. Let $\cos(x)=u$ and thus,
$$I_1:=\int\frac{\sin(x)}{\sin^4(x)+\cos^2(x)}~dx=\int\frac{-du}{(1-u^2)^2+u^2}=-\int\frac{du}{1+u^4-u^2}$$For the second part, we substitute $\sin(x)=v$ and so,
$$I_2:=\int\frac{\cos(x)}{\sin^4(x)+\cos^2(x)}~dx = \int\frac{dv}{v^4+1-v^2}=\int\frac{du}{u^4+1-u^2}$$
Now as, $I=I_1+I_2$, we conclude
$$I=\int 0~ du = \text{Constant}$$However, we get a different answer by WolframAlpha.
So my question where am I wrong in above process?
Any help will be highly appreciated.
 [/INST] You can factorize
$$
u^4-u^2+1=(u^2+\sqrt{3} u+1)(u^2-\sqrt{3} u+1),
$$
so that the partial fraction decomposition is
$$
\frac{1}{u^4-u^2+1}=\frac{1}{4 \sqrt{3}}\left[\frac{(2 u+\sqrt{3})+\sqrt{3}}{u^2+\sqrt{3} u+1}-\frac{(2 u-\sqrt{3})-\sqrt{3}}{u^2-\sqrt{3} u+1}\right],
$$
and we have
$$
\int\frac{1}{u^4-u^2+1}du=\frac{1}{4 \sqrt{3}}\log \left(\frac{u^2+\sqrt{3} u+1}{u^2-\sqrt{3} u+1}\right)+\frac{1}{2} \left[\arctan\left(2 u+\sqrt{3}\right)+\arctan\left(2u-\sqrt{3}\right)\right]+C.
$$
The two integrals become
$$
-\frac{1}{4 \sqrt{3}}\log \left(\frac{\cos ^2x+\sqrt{3} \cos
   x+1}{\cos ^2x-\sqrt{3} \cos x+1}\right)-\frac{1}{2} \left[\arctan \left(2 \cos x+\sqrt{3}\right)+\arctan\left(2 \cos x-\sqrt{3}\right)\right]+C,
$$
and
$$
+\frac{1}{4 \sqrt{3}}\log \left(\frac{\sin ^2x+\sqrt{3} \sin x+1}{\sin ^2x-\sqrt{3} \sin x+1}\right)+\frac{1}{2} \left[\arctan\left(2 \sin
   x+\sqrt{3}\right)+\arctan\left(2 \sin x-\sqrt{3}\right)\right]+C.
$$
</s>