To integrate a rational function we must decompose it using partial fractions, however we must first perform the polynomial division to have a proper rational function with the numerator of lower degree than the denominator.
Write the integrand as:
#(x^3+2x^2+1)/((x-1)(x-2)) = (x^3+2x^2+1)/(x^2-3x+2)#
#(x^3+2x^2+1)/((x-1)(x-2)) = (x^3-3x^2+2x+5x^2-2x+1)/(x^2-3x+2)#
#(x^3+2x^2+1)/((x-1)(x-2)) = (x(x^2-3x+2)+5x^2-2x+1)/(x^2-3x+2)#
#(x^3+2x^2+1)/((x-1)(x-2)) = x+(5x^2-2x+1)/(x^2-3x+2)#
#(x^3+2x^2+1)/((x-1)(x-2)) = x+(5x^2-15x+10+13x-9)/(x^2-3x+2)#
#(x^3+2x^2+1)/((x-1)(x-2)) = x+(5(x^2-3x+2)+13x-9)/(x^2-3x+2)#
#(x^3+2x^2+1)/((x-1)(x-2)) = x+5+(13x-9)/(x^2-3x+2)#
Apply partial fractions decomposition to the last fraction:
#(13x-9)/(x^2-3x+2) = A/(x-1)+B/(x-2)#
#(13x-9)/(x^2-3x+2) = (A(x-2)+B(x-1))/((x-1)(x-2))#
#13x-9 = Ax-2A+Bx-B#
#{(A+B =13),(2A+B=9):}#
#{(A=-4),(B=17):}#
and finally:
#(x^3+2x^2+1)/((x-1)(x-2)) = x+5-4/(x-1)+17/(x-2)#
and integrating:
#int (x^3+2x^2+1)/((x-1)(x-2))dx = x^2/2+5x-4lnabs(x-1)+17lnabs(x-2)+C#