Partial-faction decomposition

In calculating the inverse Laplace transform, it may be necessary to perform a partial-fraction decomposition. This is where a polynomial $\frac{p(s)}{q(s)}$ can be written in the form as a sum of a polynomial of degree $\deg(p) - \deg(q)$ (zero if this difference is negative) and rational polynomials where the denominators are factors of $q(s)$ and where the numerators always have a degree less than that of the denominator. The exact details are left to the reader to review in a relevant text book, but conversion of a rational polynomial to one that is a partial-fraction decomposition may be done as follows:

[> convert( (s^3 + 2*sx + 1)/(s^2 + 1), 'parfrac' );

$s + \frac{s + 1}{s^2 + 1}$

[> convert( (s^3 + 2*sx + 1)/(s^2 - 1), 'parfrac' );

$s + \frac{1}{s + 1} + \frac{2}{s - 1}$

[> convert( (s^3 + 2*sx + 1)/(s^4 - 2*s^2 + 1), 'parfrac' );

$-\frac{1}{2(s + 1)^2} + \frac{3}{4(s + 1)} + \frac{1}{4(s - 1)} + \frac{1}{(s - 1)^2}$

[> convert( (s^5 + 2*s^4 - 2*s^3 - s^2 + 7*s + 2)/(s^4 - 9*s^2 + 4*s + 12), 'parfrac' );

$s + 2 + \frac{4}{(s - 2)^2} - \frac{1}{6(s + 1)} + \frac{91}{15(s - 2)} + \frac{11}{10(s + 3)}$

[> factor( s^4 - 9*s^2 + 4*s + 12 );

$(s - 2)^2(s + 1)(s + 3)$