$\displaystyle \int\frac{x^3+x^2+2x+1}{(x^2+1)(x^2+2)}dx$

so I got $\displaystyle (Ax+B)(x^2+2)+(Cx+D)(x^2+1) = x^3+x^2+2x+1$

If I factor an x out of everything but the D constant, and set x=0 then I know D=1 but I'm stuck on how to find the value of the other constants.

also $\displaystyle \int\frac{x^3+4}{x^2+4}dx$

answer 1: $\displaystyle .5\ln(x^2+1)+(1+/\sqrt2)\arctan(x/\sqrt2)+C$

answer 2: $\displaystyle .5x^2-2\ln(x^2+4)+2\arctan(x/2)+C$