Previous Up Next

6.32.9 Partial fraction expansion: partfrac cpartfrac

The partfrac and cpartfrac commands find the partial fraction expansion of a rational function.


Example.
Find the partial fraction expansion of:

x5−2x3+1
x4−2x3+2x2−2x+1

over the real numbers. Input (in real mode):

partfrac((x^5-2*x^3+1)/(x^4-2*x^3+2*x^2-2*x+1))

Output:

x+2−
1
2 ⎛
⎝
x−1⎞
⎠
+
x−3
2 ⎛
⎝
x2+1⎞
⎠

To find the partial fraction decomposition over the complex numbers, you can either put Xcas in complex mode (see Section ‍3.5.5) or use cpartfrac.
Input (in complex mode):

partfrac((x^5-2*x^3+1)/(x^4-2*x^3+2*x^2-2*x+1))

or, in real or complex mode:

cpartfrac((x^5-2*x^3+1)/(x^4-2*x^3+2*x^2-2*x+1))

Output:

x+2−
1
2 ⎛
⎝
x−1⎞
⎠
+
−1−2 i
⎛
⎝
2−2 i⎞
⎠
⎛
⎝
x+i⎞
⎠
+
2+i
⎛
⎝
2−2 i⎞
⎠
⎛
⎝
x−i⎞
⎠

Previous Up Next