Full algorithm for rational functions integration Is there a full algorithm for finding the integral of rational functions?
 A: According to wikipedea: 

A rational function is any function which can be defined by a rational fraction.

So a rational function can be written as   a fraction of two polynomials: $$ f(x)= \frac{P(x)}{Q(x)} $$
Usually integrating such functions goes through these General procedures:


*

*If degree of $P(x)$ is greater than or equal degree of  $Q(x)$ we use the  Polynomial long division: so that we may write  $$f(x)=\frac{P(x)}{Q(x)}=q(x)+ \frac{r(x)}{Q(x)}  $$
with $q(x) $  is a polynomial and  $r(x)$ is a polynomial whose degree is less than strictly the degree of  $Q(x)$. Note that integrating a polynomial is the most easy integrating part (I mean here integrating  $q(x)$), thus we are left with  the new  retional fucntion $\frac{r(x)}{Q(x)}$ where degree of the numerator is strictly less than the degree of the denominator, so move to the second case 

*If degree of  $P(x)$ is less than stricly degree of  $Q(x)$. 


If degree$Q(x)- $degree$P(x)=1$, ( except the case constant over polynomail of degree one which integrate into logarithm)  try to modify the numerator ( using multiplication/division by a scalar and/or adding/subtracting   a polynomial) in order to end up with  a new numerator  $\hat{P}(x)$ such that $$ Q'(x)=\hat{P}(x) $$ Then for integrating this, you may use change of variable  with   : let $u= Q(x)$  and  $du= \hat{P}(x) dx$. A small simple example to clarify the idea here is  integrating  $f(x)=\frac{x}{x^2+1}$  or   $g(x)=\frac{2x^2}{ x^3+x^2+1}$. Note that for integrating $g(x)$ you may not only multiply  and divide the function by  $\frac{3}{2}$ but you have also to add  and   subtract after $2x$  so you get  $$\frac{2x^2}{ x^3+x^2+1}= \frac{2}{3}\frac{3x^2+2x-2x }{ x^3+x^2+1} =\frac{2}{3}\frac{3x^2+2x-2x }{ x^3+x^2+1}- \frac{2}{3}\frac{2x }{ x^3+x^2+1} $$ The first part is clearly as I explained above,  for the second part we move to the following cases. 
If degree$Q(x)- $degree$P(x)>1$, then you may use the Partial fraction decomposition, turning your fraction into much more simple fractions hopefully with the difference between the degree of the numerator and the denominator is one.
A special that you mmay usually recognize, is when having an constant over a degree two polynomail, in this case the $ \arctan $ function will solve the problem by complete squaring the denominator.
I don,t have a full algorithm for integrating a fractional function, but I think this may lead you to an outline:  how you can proceed in some general cases.  
