### 11.6.9 Partial fraction expansion

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

- partfrac takes rat, a rational function.
- partfrac(rat) returns the partial fraction expansion of rat.

  The partfrac command is equivalent to the convert command (see Section 10.1.10) with parfrac (or partfrac or fullparfrac) as option.

- cpartfrac(rat) behaves just like partfrac, except that it always finds the partial fraction expansion over ℂ.

#### 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))

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 2.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))

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