Calculate the following indefinite integral Calculate: $$\int \frac{(2x^{2}+x+\frac{1}{2})\cos2x+(6x^{2}-7x+\frac{13}{2})\sin2x}{\sqrt{(x^{2}-x+1)^{3}}}dx.$$
I have no idea how to start it.
 A: Let $u = x^2-x+1$, we have $u' = 2x-1$. Notice
$$\begin{align}
2x^2+x+\frac12 &= 2(x^2-x+1) + \frac32 (2x-1) = 2u + \frac32 u'\\
  6x^2-7x+\frac{13}{2} &= 6(x^2-x+1) - \frac12(2x-1) = 6u - \frac12 u'
\end{align}
$$
The integrand of the integral can be rewritten as
$$\begin{align}
 & \frac{(2u + \frac32 u')\cos(2x) + (6u - \frac12u')\sin(2x)}{u^{3/2}}\\
= & \left(-\frac12 \frac{u'}{u^{3/2}}\right)(\sin(2x)-3\cos(2x)) 
+  \frac{1}{u^{1/2}}(\sin(2x)-3\cos(2x))'\\
= & \left(\frac{\sin(2x)-3\cos(2x)}{u^{1/2}}\right)'
\end{align}$$
This implies the indefinite integral equals to
$$\frac{\sin(2x)-3\cos(2x)}{\sqrt{x^2-x+1}} + \text{ constant }$$
A: Maybe start off by doing this:
$\int\frac{(2x^2 + x + \frac{1}{2})\text{cos}2x}{\sqrt{(x^2-x+1)^3}}dx + \int\frac{(6x^2 - 7x + \frac{13}{2})\text{sin}2x}{\sqrt{(x^2-x+1)^3}}dx$
This integral is a disgusting beast!
A: $$\int \frac{(2x^{2}+x+\frac{1}{2})\cos2x+(6x^{2}-7x+\frac{13}{2})\sin2x}{\sqrt{(x^{2}-x+1)^{3}}}dx \\=\int \frac{\cos2x}{\sqrt{x^2-x+1}}\Big(2+\frac{3x-\frac{3}{2}}{x^2-x+1}\Big)+ \frac{\sin2x}{\sqrt{x^2-x+1}}\Big(6+\frac{-x+\frac{1}{2}}{x^2-x+1}\Big)dx \\=\int\Bigg(\Big(\frac{2\cos2x}{\sqrt{x^2-x+1}}+\frac{6\sin2x}{\sqrt{x^2-x+1}}\Big)+\Big(\frac{\cos2x}{\sqrt{x^2-x+1}}.\frac{3x-\frac{3}{2}}{x^2-x+1}+\frac{\sin2x}{\sqrt{x^2-x+1}}.\frac{-x+\frac{1}{2}}{x^2-x+1}\Big)\Bigg)dx\\=\int\Bigg(\frac{2(\cos2x+3\sin2x)}{\sqrt{x^2-x+1}}+\frac{1}{2}.\frac{(3\cos2x-\sin2x)}{\sqrt{x^2-x+1}}.\frac{2x-1}{(x^2-x+1)}\Bigg)dx\\=\int \frac{d}{dx}\Bigg(\frac{-(3\cos2x-\sin2x)}{\sqrt{x^2-x+1}}\Bigg)dx\\=\frac{-(3\cos2x-\sin2x)}{\sqrt{x^2-x+1}}$$
A: Mathematica says:
$$
-\frac{\left(x^2-x+1\right) (3 \cos (2 x)-\sin (2 x))}{\sqrt{\left(x^2-x+1\right)^3}}.
$$
Surprisingly nice.
