<s>[INST] Evaluating $\int \frac{x^2-1}{x\sqrt{x^2+ax+1}\sqrt{x^2+bx+1}} dx$ 
The question is to evaluate $$\int \frac{x^2-1}{x\sqrt{x^2+ax+1}\sqrt{x^2+bx+1}} dx$$

I tried to rewrite the integral as $$\frac{ab}{b-a}\int \frac{1/a(x^2+ax+1)-1/b(x^2+bx+1)}{x\sqrt{x^2+ax+1}\sqrt{x^2+bx+1}} dx-2\int \frac{1}{x\sqrt{x^2+ax+1}\sqrt{x^2+bx+1}} dx$$ For the second integral I rewrite it as $$\int \frac{1}{x^3\sqrt{\frac1{x^2}+\frac{a}{x}+1}\sqrt{\frac1{x^2}+\frac{b}{x}+1}} dx$$ Now I used the substitution $x\to 1/x$ to yield $$-\int \frac{1}{x\sqrt{x^2+ax+1}\sqrt{x^2+bx+1}} dx$$ which makes the second integral to vanish.However i could not proceed with the first integral.Any ideas.Thanks.
 [/INST] Suppose $x>0$. Letting $x+\frac{1}{x}\to u$ and then $du=(1-\frac{1}{x^2})dx$, one has
\begin{eqnarray}
&&\int \frac{x^2-1}{x\sqrt{x^2+ax+1}\sqrt{x^2+bx+1}} dx\\
&=&\int\frac{1-\frac1{x^2}}{\sqrt{x+a+\frac{1}{x}}\sqrt{x+b+\frac{1}{x}}} dx\\
&=&\int\frac{1}{\sqrt{u+a}\sqrt{u+b}}du\\
&=&\int\frac{1}{\sqrt{(u+\frac{a+b}2)^2-(\frac{a-b}{2})^2}}du\\
\end{eqnarray}
It is not hard to get the integral. I omit the detail.
</s>