partfrac
-- compute a partial
fraction decompositionpartfrac
(f, x)
returns the partial
fraction decomposition of the rational expression f with
respect to the variable x.
partfrac(f <, x>)
f |
- | a rational expression in
x |
x |
- | the indeterminate: typically, an identifier or an indexed identifier. |
Chapter ``Manipulating Expressions'' of the Tutorial.
collect
, denom
, divide
, expand
, factor
, normal
, numer
, rectform
, rewrite
, simplify
degree
(p)
< degree
(q). Here,
q = denom(f)
is the denominator of f, and g, p, given by
(g, p) =
divide(
numer(f), q, [x]), are the quotient and the
remainder of the polynomial division of the numerator of f
by the denominator q. Let
q(x)=q1(x)^e1*q2(x)^e2* ..be a factorization of the denominator into nonconstant and pairwise coprime polynomials q.i with integer exponents e.i. The partial fraction decomposition based on this factorization is a representation
f(x) = g(x) + p[1,1](x)/q1(x) +...+ p[1,e1](x)/(q1^e1(x)) + p[2,1](x)/q2(x) +...+ p[2,e2](x)/(q2^e2(x)) + ...with polynomials pij satisfying
degree
(p[i,j])
< degree
(q.i). In
particular, the polynomials p[i,j] are constant if
q.i is a linear polynomial.
partfrac
uses the factors q.i of
q
= denom(f)
found by the function
factor
. The
factorization is computed over the field implied by the coefficients of
the denominator (see factor
for details). Cf. example 2.
x
in a call to
partfrac
can be omitted if f
has only one
indeterminate.In the following calls, there is no need to specify an indeterminate because the rational expressions are univariate:
>> partfrac(x^2/(x^3 - 3*x + 2))
5 1 4 --------- + ---------- + --------- 9 (x - 1) 2 9 (x + 2) 3 (x - 1)
>> partfrac(23 + (x^4 + x^3)/(x^3 - 3*x + 2))
19 2 8 x + --------- + ---------- + --------- + 24 9 (x - 1) 2 9 (x + 2) 3 (x - 1)
The following expression contains two indeterminates
x
and y
. One has to specify the variable with
respect to which the partial fraction decomposition shall be
computed:
>> f := x^2/(x^2 - y^2): partfrac(f, x), partfrac(f, y)
y y x x 1 - --------- - ---------, --------- - --------- 2 (y - x) 2 (x + y) 2 (x + y) 2 (y - x)
>> delete f:
In the following, we demonstrate the dependence of the
partial fraction decomposition on the function factor
:
>> partfrac(1/(x^2 + 2), x)
1 ------ 2 x + 2
Note that the denominator x^2 + 2 does not factor over the rational numbers:
>> factor(x^2 + 2)
2 x + 2
However, it factors over the extension containing
sqrt(-2). In the following calls, this extended coefficient
field is implicitly assumed by factor
and, consequently, by
partfrac
:
>> factor(sqrt(-2)*x^2 + 2*sqrt(-2))
1/2 1/2 1/2 (I 2 ) (x - I 2 ) (x + I 2 )
>> partfrac(x/(sqrt(-2)*x^2 + 2*sqrt(-2)), x)
1/2 / 1 1 \ - 1/2 I 2 | -------------- + -------------- | | 1/2 1/2 | \ 2 (x - I 2 ) 2 (x + I 2 ) /
Rational expressions of symbolic function calls may also be decomposed into partial fractions:
>> partfrac(1/(sin(x)^4 - sin(x)^2 + sin(x) - 1), sin(x))
2 2 sin(x) sin(x) - -------- - ------- - 2/3 1 3 3 -------------- + -------------------------- 3 (sin(x) - 1) 2 3 sin(x) + sin(x) + 1