Expands the expression expr in partial fractions
with respect to the main variable var. partfrac does a complete
partial fraction decomposition. The algorithm employed is based on
the fact that the denominators of the partial fraction expansion (the
factors of the original denominator) are relatively prime. The
numerators can be written as linear combinations of denominators, and
the expansion falls out.
partfrac ignores the value true of the option variable
keepfloat.
(%i1) 1/(1+x)^2 - 2/(1+x) + 2/(2+x);
2 2 1
(%o1) ----- - ----- + --------
x + 2 x + 1 2
(x + 1)
(%i2) ratsimp (%);
x
(%o2) - -------------------
3 2
x + 4 x + 5 x + 2
(%i3) partfrac (%, x);
2 2 1
(%o3) ----- - ----- + --------
x + 2 x + 1 2
(x + 1)