<s>[INST] integration of. $\int \frac{x}{x^3-3x+2}$ I am trying to integrate    :

$\Large \int \frac{x}{x^3-3x+2}dx$

I decomposed the fraction and got :
$\Large \frac{x}{x^3-3x+2} = \frac {x}{(x-1)^2(x+2)}$
Then I tried to get two different fractions:
$ \Large \frac {x}{(x-1)^2(x+2)} = \frac {Ax}{(x-1)^2} + \frac {B}{(x+2)}$
Well I got A=1/3 and B=-1/3. as possible values. but that was not correct. I guess I missed something. 
 [/INST] When the denominator of a fraction has an irreducible factor $\bigl(p(x)\bigr)^m$ with order of multiplicity $m>1$, its contribution to the decomposition into partial fractions is not
$$\frac{A(x)}{\bigl(p(x)\bigr)^m} \qquad (\deg A(x)<\deg p(x)),$$
but
$$\frac{A_1(x)}{p(x)\vphantom{\Big)}}+\frac{A_2(x)}{\bigl(p(x)\bigr)^2}+\dots+\frac{A_m(x)}{\bigl(p(x)\bigr)^m}\\(\deg A_1(x),\deg A_2(x),\dots,\deg A_m(x)<\deg p(x)) $$
Therefore here, as the irreducible factors have degree $1$, the decomposition has the form
$$\frac{x}{x^3-3x+2} = \frac {x}{(x-1)^2(x+2)}=\frac{A}{x-1}+\frac{B}{(x-1)^2}+\frac{C}{x+2}.$$
Addendum: 
Here is the short way to determine the coefficients: multiply both sides of the above equality by $(x-1)^2(x+2)$ to obtain the relation
$$x=(x-1)(x+2)A+(x+2)B+(x-1)^2C.$$
Setting $x=1$, then $x=-2$, yields instantly
$B=\frac 13$ and $C=-\frac29$. To obtain $C$, observe that the r.h.s. must have no quadratic term, so $A+C=0$ and finally $A=\frac29$.
</s>