How to integrate the product of two or more polynomials raised to some powers, not necessarily integral This question is inspired by my own answer to a question which I tried to answer and got stuck at one point. 

The question was:

HI DARLING.
USE MY ATM CARD, TAKE ANY AMOUNT OUT, GO SHOPPING AND TAKE YOUR FRIENDS FOR LUNCH.
PIN CODE: $\displaystyle \int_{0}^{1} \frac{3x^3 - x^2 + 2x - 4}{\sqrt{x^2 - 3x + 2}} \, dx $
I LOVE YOU HONEY.
Anyone knows? Are we gonna get an integer number?


My attempt:
Does this help?

$$\frac{3x^3-x^2+2x-4}{x-1}=3x^2+2x+4$$
  (long division)
  \begin{align*}
I&=\int\frac{3x^3-x^2+2x-4}{[(x-1)(x-2)]^{1/2}} dx = \\
&=\int\frac{(3x^2+2x+4)(x-1)^{1/2}}{(x-2)^{1/2}} dx = \\
&=\int 3(u^4-4u^2-4)(u^2+1)^{1/2}du \times 2
\end{align*}
  after the substitution
  \begin{gather*}
(x-2)^{1/2}=u\\
du=\frac1{2(x-2)^{1/2}}dx\\
u^2=x-2\\
(x-1)^{1/2}=(u^2+1)^{1/2}
\end{gather*}

Update: This may help us proceed.

I tried to proceed:

$$6\int (u^4-4u^2-4)(u^2+1)^{1/2} du = 6\int ((t-3)^2-8)t \frac{dt}{2u}$$
  after $u^2+1=t$ and $dt=2udu$
  \begin{align*}
u^4-4u^2-4
&= (u^2+1)^2-(6u^2+5) \\
&= (u^2+1)^2-6(u^2+1)+1 \\
&= ((u^2+1)-3)^2-8
\end{align*}

I wonder whether this question can be solved from here?

Update: 
This has been getting a lot of views, and I think most people came for the sort of problem mentioned in the title (where I got stuck) rather than the original problem itself.
Keepin this in mind, I'm reopening the question and here's the kind of answers I expect — Solutions to the original problem are good, but I'd prefer solutions that continue from the part where I got stuck — the polynomial in $u$ — that's the sort of problem mentioned in the title.
 A: Alternative method:
$
\def\lfrac#1#2{{\large\frac{#1}{#2}}}
$
Express the integrand in the form $\lfrac{(2ax+b)·(x^2-3x+2)+(2cx+d)}{\sqrt{x^2-3x+2}}$ for some constants $a,b,c,d$.
Then split it into $( a(2x-3) + (3a+b) ) · \sqrt{x^2-3x+2} + \lfrac{c(2x-3)+(3c+d)}{\sqrt{x^2-3x+2}}$, so that as a sum of four terms the first and third have obvious antiderivatives. The other two terms can be solved by standard techniques.
A: $\require{begingroup}\begingroup$This should help to get closer to the final result (if you want to calculate this manually):
$$\newcommand{\dd}{\; \mathrm{d}} I=\int_0^1 \frac{3x^3 - x^2 + 2x - 4}{\sqrt{x^2 - 3x + 2}} \dd x = 
\int_0^1 \frac{3x^3 - x^2 + 2x - 4}{\sqrt{(x-\frac32)^2 -\frac14}} \dd x$$
It will take some computing but we can get that
$3x^3 - x^2 + 2x - 4 = 3(x-\frac32)^3+\frac{25}2(x-\frac32)^2+\frac{77}4(x-\frac32)+\frac{55}8$. 
So we have
$$I=
\int_{-3/2}^{-1/2} \frac{3u^3+\frac{25}2u^2+\frac{77}4u+\frac{55}8}{\sqrt{u^2-\frac14}} \dd u = 
\begin{vmatrix}
  t=2u & u=\frac t2 \\
  \dd t=2\dd u & \dd u = \frac12\dd t
\end{vmatrix} = 
\frac12 \int_{-3}^{-1} \frac{\frac{3t^3}8+\frac{25}8t^2+\frac{77}8t+\frac{55}8}{\sqrt{\frac{t^2}4-\frac14}} \dd t =
\frac18 \int_{-3}^{-1} \frac{3t^3+25t^2+77t+55}{\sqrt{t^2-1}} \dd t =
\frac18 \int_{-3}^{-1} \frac{3t(t^2-1)+25(t^2-1)+80t+80}{\sqrt{t^2-1}} \dd t = 
\frac18 \int_{-3}^{-1} (3t+25)\sqrt{t^2-1} +80 \frac{t+1}{\sqrt{t^2-1}} \dd t 
$$
You can check that Wolfram Alpha returns the same value for the original integral and this integral. (To be honest, I am not sure how I am supposed to get a PIN number from the result.)
Now you could divide up this into separate integrals which should be not too difficult:


*

*How to calculate this integral with square roots: $\int\frac{ \sqrt{x+1} }{ \sqrt{ x-1 }} \, dx$

*Indefinite integral of $\int\sqrt{x^2-1}dx$

*For $\int t\sqrt{t^2-1} \dd t$ the substitution $s=t^2-1$ seems reasonable.


$\endgroup$
A: Looking at your previous deleted post, one answer suggested to use Euler subtitution
$$\sqrt{x^2-3x+2}=t+x\implies x=\frac{2-t^2}{2t+3}\implies dx=-\frac{2 (t+1) (t+2)}{(2 t+3)^2}\,dt$$ Replacing, we arrive to
$$\frac{3x^3 - x^2 + 2x - 4}{\sqrt{x^2 - 3x + 2}}=\frac{2 (t+1)^2 \left(3 t^4-4 t^3-2 t^2+56 t+60\right)}{(2 t+3)^4}$$ Now let $2t+3=u$ to make the integrand
$$\frac{3 u^2}{64}-\frac{25 u}{32}+\frac{317}{64}-\frac{135}{16 u}+\frac{317}{64
   u^2}-\frac{25}{32 u^3}+\frac{3}{64
   u^4}$$ and the antiderivative
$$\frac{u^3}{64}-\frac{25 u^2}{64}+\frac{317 u}{64}-\frac{135}{16} \log
   \left({u}\right)-\frac{317}{64 u}+\frac{25}{64 u^2}-\frac{1}{64
   u^3}$$ For $t$, the bounds were $(\sqrt 2,-1)$; so, for $u$, they are $(2\sqrt 2+3,1)$ giving as a result
$$ \int_{0}^{1} \frac{3x^3 - x^2 + 2x - 4}{\sqrt{x^2 - 3x + 2}} \, dx=\frac{135}{16} \log \left(3+2 \sqrt{2}\right)-\frac{101}{4 \sqrt{2}}\approx -2.98127$$
A: Noticing that
$3 x^3-x^2+2 x-4=-(1-x)\left(3 x^2+2 x+4\right)$ and $x^2-3 x+2=(1-x)(2-x)$,
we transform the integral into
$$
I=-\int_0^1 \sqrt{\frac{1-x}{2-x}}\left(3 x^2+2 x+4\right) d x
$$
Let $t^2=\frac{1-x}{2-x}$, then $x=\frac{2 t^2-1}{t^2-1}$ and $d x=-\frac{2 t}{\left(t^2-1\right)^2} d t$, which changes the integral into
$$
I=-2 \int_0^{\frac{1}{\sqrt{2}}} \frac{t^2\left(20 t^4-26 t^2+9\right)}{\left(t^2-1\right)^4} d t
$$
Resolving the integrand into partial fractions as
$$ \frac{t^2\left(20 t^4-26 t^2+9\right)}{\left(t^2-1\right)^4} = {-\frac{135}{32} \cdot \frac{1}{t+1}+\frac{185}{32} \cdot \frac{1}{(t+1)^2}-\frac{7}{4} \cdot \frac{1}{(t+1)^3}+\frac{3}{16} \cdot \frac{1}{(t+1)^4}}+\frac{135}{32} \cdot \frac{1}{t-1}+\frac{185}{32} \cdot \frac{1}{(t-1)^2}+\frac{7}{4} \cdot \frac{1}{(t-1)^3}+\frac{3}{16}\cdot \frac{1}{(t-1)^4}$$
Integrating it from $0$ to $\frac{1}{\sqrt 2} $ yields
$$
\begin{aligned}
I=&-2 \left[-\frac{135}{32} \ln |t+1|-\frac{185}{32(t+1)}+\frac{7}{8(t+1)^2}-\frac{1}{16(t+1)^3} +\frac{135}{32} \ln |t-1|\right.\\ &\left.-\frac{185}{32(t-1)}-\frac{7}{8(t-1)^2}-\frac{1}{16(t-1)^3}\right]_0^{\frac{1}{\sqrt{2}}}\\=& \frac{135}{16} \ln (3+2 \sqrt{2})-\frac{101 \sqrt{2}}{8}
\end{aligned}
$$
A: Noticing that
$ 3 x^3-x^2+2 x-4=\frac{3}{2}(2 x-3)\left(x^2-3 x+2\right)+\frac{5}{2}\left(5 x^2-7 x+2\right),$
we have $$
I=\frac{3}{2} \underbrace{\int_0^1(2 x-3) \sqrt{x^2-3 x+2} d x}_J+\frac{5}{2} \underbrace{\int_0^1 \frac{5 x^2-7 x+2}{\sqrt{x^2-3 x+2}} d x}_K
$$$$
\begin{aligned}
J =\frac{3}{2} \int_0^1 \sqrt{x^2-3 x+2} d\left(x^2-3 x+2\right) =\left[\left(x^2-3 x+2\right)^{\frac{3}{2}}\right]_0^1=-2 \sqrt{2}
\end{aligned}
$$
Again, decompose the numerator of the integrand of $K$ into 3 parts as
$$
5 x^2-7 x+2=5\left(x^2-3 x+2\right)+4(2 x-3)+4,
$$
we get
$$
\begin{aligned}
K&=5  \int_0^1 \sqrt{x^2-3 x+2} d x+4 \int_0^1 \frac{d\left(x^2-3 x+2\right)}{\sqrt{x^2-3 x+2}} +4 \int \frac{d x}{\sqrt{x^2-3 x+2}}\\&= 5 \cdot \frac{1}{8}(6 \sqrt{2}-\ln (3+2 \sqrt{2}))-8 \sqrt{2}+4 \ln (3+2 \sqrt{2}) \cdots(*)\\&= -\frac{17}{4} \sqrt{2}+\frac{27}{8} \ln (3+2 \sqrt{2})
\end{aligned}
$$
where $(*)$ comes from my post.
Plugging back yields
$$
\boxed{I=\frac{135}{16} \ln (3+2 \sqrt{2})-\frac{101}{8} \sqrt{2}}
$$
