|
D.15.15.1 pfd
Procedure from library pfd.lib (see pfd_lib).
- Usage:
- pfd(f,g[,debug]); f,g poly, debug int
pfd(f,g[,debug]); f poly, g list, debug int
pfd(arguments[, parallelize]); arguments list, parallelize int
- Return:
- a partial fraction decomposition of f/g as a list
l where
l[1] is an ideal generated by irreducible polynomials and
l[2] is a list of fractions.
Each fraction is represented by a list of
1) the numerator polynomial
2) an intvec of indices i for which l[1][i] occurs
as a factor in the denominator
3) an intvec containing the exponents of those irreducible factors.
Setting debug to a positive integer measures runtimes and
creates a log file (default: debug=0 ).
The denominator g can also be given in factorized form as a list of
an ideal of irreducible non constant polynomials and an intvec of
exponents. This can save time since the first step in the algorithm is
to factorize g. (A list of the zero-ideal and an empty intvec
represents a denominator of 1.)
If instead of f and g, the input is a single list (or even a list of
lists) containing elements of the form list(f,g[,debug])
(f,g,debug as above), the algorithm is applied to all entries
in parallel (using parallel_lib), if parallelize=1
(default) and in sequence if parallelize=0 . A list (or list of
lists) of the results is returned.
- Note:
- The result depends on the monomial ordering. For "small" results
use
dp .
Example:
| LIB "pfd.lib";
ring R = 0,(x,y),dp;
poly f = x^3+3*x^2*y+2*y^2-x^2+4*x*y;
poly g = x^2*y*(x-1)*(x-y)^2;
list dec = pfd(f,g);
==> (2) / (q3*q4)
==> + (-2) / (q1*q4)
==> + (-6) / (q3*q4^2)
==> + (1) / (q2*q4^2)
==> + (9) / (q1*q4^2)
==> + (2) / (q3^2*q4)
==> where
==> q1 = x-1
==> q2 = y
==> q3 = x
==> q4 = x-y
==> (6 terms)
==>
displaypfd_long(dec); // display result
==> (2)/((x)*(x-y))
==> + (-2)/((x-1)*(x-y))
==> + (-6)/((x)*(x-y)^2)
==> + (1)/((y)*(x-y)^2)
==> + (9)/((x-1)*(x-y)^2)
==> + (2)/((x)^2*(x-y))
==> (6 terms)
==>
checkpfd(list(f,g),dec); // check for equality to f/g
==> 1
// calculate decompositions of a 2x2 matrix of rational functions at once:
list arguments = list(list(f, g), list(1, f) ),
list(list(x*y, y+1), list(1, x^2-y^2));
dec = pfd(arguments);
// the result has the same shape as the
// input (2x2 matrix as list of lists):
displaypfd_long(dec[1][1]);
==> (2)/((x)*(x-y))
==> + (-2)/((x-1)*(x-y))
==> + (-6)/((x)*(x-y)^2)
==> + (1)/((y)*(x-y)^2)
==> + (9)/((x-1)*(x-y)^2)
==> + (2)/((x)^2*(x-y))
==> (6 terms)
==>
displaypfd_long(dec[1][2]);
==> (1)/((x^3+3*x^2*y-x^2+4*x*y+2*y^2))
==> (1 terms)
==>
displaypfd_long(dec[2][1]);
==> (x)
==> + (-x)/((y+1))
==> (2 terms)
==>
displaypfd_long(dec[2][2]);
==> (1)/((x-y)*(x+y))
==> (1 terms)
==>
// a more complicated example
ring S = 0,(s12,s15,s23,s34,s45),dp;
poly f = 7*s12^4*s15^2 + 11*s12^3*s15^3 + 4*s12^2*s15^4 - 10*s12^4*s15*s23
- 14*s12^3*s15^2*s23 - 4*s12^2*s15^3*s23 + 3*s12^4*s23^2 + 3*s12^3*s15*s23^2
+ 13*s12^4*s15*s34 + 12*s12^3*s15^2*s34 + 2*s12^2*s15^3*s34
- 5*s12^4*s23*s34 + 33*s12^3*s15*s23*s34 + 49*s12^2*s15^2*s23*s34
+ 17*s12*s15^3*s23*s34 - 17*s12^3*s23^2*s34 - 19*s12^2*s15*s23^2*s34
- 5*s12*s15^2*s23^2*s34 - 24*s12^3*s15*s34^2 - 15*s12^2*s15^2*s34^2
+ 2*s12*s15^3*s34^2 + 15*s12^3*s23*s34^2 - 34*s12^2*s15*s23*s34^2
- 31*s12*s15^2*s23*s34^2 + 2*s15^3*s23*s34^2 + 33*s12^2*s23^2*s34^2
+ 29*s12*s15*s23^2*s34^2 + 5*s15^2*s23^2*s34^2 + 9*s12^2*s15*s34^3
- 4*s12*s15^2*s34^3 - 15*s12^2*s23*s34^3 + 9*s12*s15*s23*s34^3
- 4*s15^2*s23*s34^3 - 27*s12*s23^2*s34^3 - 13*s15*s23^2*s34^3
+ 2*s12*s15*s34^4 + 5*s12*s23*s34^4 + 2*s15*s23*s34^4 + 8*s23^2*s34^4
- 6*s12^3*s15^2*s45 - 9*s12^2*s15^3*s45 - 2*s12*s15^4*s45
+ 30*s12^3*s15*s23*s45 + 56*s12^2*s15^2*s23*s45 + 24*s12*s15^3*s23*s45
- 12*s12^3*s23^2*s45 - 23*s12^2*s15*s23^2*s45 - 10*s12*s15^2*s23^2*s45
- 30*s12^3*s15*s34*s45 - 32*s12^2*s15^2*s34*s45 - 6*s12*s15^3*s34*s45
+ 7*s12^3*s23*s34*s45 - 86*s12^2*s15*s23*s34*s45 - 104*s12*s15^2*s23*s34*s45
- 15*s15^3*s23*s34*s45 + 41*s12^2*s23^2*s34*s45 + 51*s12*s15*s23^2*s34*s45
+ 10*s15^2*s23^2*s34*s45 - 5*s12^3*s34^2*s45 + 33*s12^2*s15*s34^2*s45
+ 14*s12*s15^2*s34^2*s45 - 2*s15^3*s34^2*s45 - 21*s12^2*s23*s34^2*s45
+ 62*s12*s15*s23*s34^2*s45 + 28*s15^2*s23*s34^2*s45 - 46*s12*s23^2*s34^2*s45
- 28*s15*s23^2*s34^2*s45 + 10*s12^2*s34^3*s45 - s12*s15*s34^3*s45
+ 4*s15^2*s34^3*s45 + 21*s12*s23*s34^3*s45 - 6*s15*s23*s34^3*s45
+ 17*s23^2*s34^3*s45 - 5*s12*s34^4*s45 - 2*s15*s34^4*s45 - 7*s23*s34^4*s45
- 6*s12^2*s15^2*s45^2 - 5*s12*s15^3*s45^2 - 2*s15^4*s45^2
- 28*s12^2*s15*s23*s45^2 - 42*s12*s15^2*s23*s45^2 - 10*s15^3*s23*s45^2
+ 9*s12^2*s23^2*s45^2 + 10*s12*s15*s23^2*s45^2 + 24*s12^2*s15*s34*s45^2
+ 36*s12*s15^2*s34*s45^2 + 10*s15^3*s34*s45^2 - 11*s12^2*s23*s34*s45^2
+ 31*s12*s15*s23*s34*s45^2 + 25*s15^2*s23*s34*s45^2
- 18*s12*s23^2*s34*s45^2 - 10*s15*s23^2*s34*s45^2 + 4*s12^2*s34^2*s45^2
- 29*s12*s15*s34^2*s45^2 - 17*s15^2*s34^2*s45^2 + 27*s12*s23*s34^2*s45^2
+ 2*s15*s23*s34^2*s45^2 + 9*s23^2*s34^2*s45^2 - 3*s12*s34^3*s45^2
+ 10*s15*s34^3*s45^2 - 16*s23*s34^3*s45^2 - s34^4*s45^2 + 6*s12*s15^2*s45^3
+ 3*s15^3*s45^3 + 8*s12*s15*s23*s45^3 + 10*s15^2*s23*s45^3
- 8*s12*s15*s34*s45^3 - 10*s15^2*s34*s45^3 + 9*s12*s23*s34*s45^3
+ s12*s34^2*s45^3 + 8*s15*s34^2*s45^3 - 9*s23*s34^2*s45^3 - s34^3*s45^3
- s15^2*s45^4 + s15*s34*s45^4;
poly g = 4*s12*s15*(s12 + s15 - s34)*(s15 - s23 - s34)*(s12 + s23 - s45)
*(s12 - s34 - s45)*(s12 + s15 - s34 - s45)*s45;
list dec = pfd(f,g);
==> (5/4) / (q7*q8)
==> + (-11/4) / (q6*q8)
==> + (3/4) / (q5*q8)
==> + (-11/4) / (q4*q8)
==> + (1/4) / (q3*q8)
==> + (5/4) / (q2*q8)
==> + (1) / (q1*q8)
==> + (1/2) / (q6*q7)
==> + (1) / (q5*q6)
==> + (-3/2) / (q2*q6)
==> + (-1/4) / (q3*q4)
==> + (3) / (q1*q4)
==> + (1/4) / (q1*q2)
==> + (5/4*s45) / (q1*q7*q8)
==> + (11/4*s45) / (q1*q6*q8)
==> + (-3/4*s34) / (q1*q5*q8)
==> + (11/4*s45) / (q1*q4*q8)
==> + (-1/4*s34) / (q1*q3*q8)
==> + (1/4*s45) / (q1*q2*q8)
==> + (s34) / (q5*q6*q7)
==> + (-1/2*s45) / (q1*q6*q7)
==> + (19/4*s34) / (q4*q5*q7)
==> + (-3/4*s23) / (q2*q5*q6)
==> + (-7/4*s34) / (q1*q4*q5)
==> + (2*s34) / (q1*q2*q5)
==> + (2*s34^2) / (q1*q2*q4*q5)
==> where
==> q1 = s12
==> q2 = s15
==> q3 = s12+s15-s34
==> q4 = s15-s23-s34
==> q5 = s45
==> q6 = s12+s23-s45
==> q7 = s12-s34-s45
==> q8 = s12+s15-s34-s45
==> (26 terms)
==>
displaypfd(dec);
==> (5/4) / (q7*q8)
==> + (-11/4) / (q6*q8)
==> + (3/4) / (q5*q8)
==> + (-11/4) / (q4*q8)
==> + (1/4) / (q3*q8)
==> + (5/4) / (q2*q8)
==> + (1) / (q1*q8)
==> + (1/2) / (q6*q7)
==> + (1) / (q5*q6)
==> + (-3/2) / (q2*q6)
==> + (-1/4) / (q3*q4)
==> + (3) / (q1*q4)
==> + (1/4) / (q1*q2)
==> + (5/4*s45) / (q1*q7*q8)
==> + (11/4*s45) / (q1*q6*q8)
==> + (-3/4*s34) / (q1*q5*q8)
==> + (11/4*s45) / (q1*q4*q8)
==> + (-1/4*s34) / (q1*q3*q8)
==> + (1/4*s45) / (q1*q2*q8)
==> + (s34) / (q5*q6*q7)
==> + (-1/2*s45) / (q1*q6*q7)
==> + (19/4*s34) / (q4*q5*q7)
==> + (-3/4*s23) / (q2*q5*q6)
==> + (-7/4*s34) / (q1*q4*q5)
==> + (2*s34) / (q1*q2*q5)
==> + (2*s34^2) / (q1*q2*q4*q5)
==> where
==> q1 = s12
==> q2 = s15
==> q3 = s12+s15-s34
==> q4 = s15-s23-s34
==> q5 = s45
==> q6 = s12+s23-s45
==> q7 = s12-s34-s45
==> q8 = s12+s15-s34-s45
==> (26 terms)
==>
checkpfd(list(f,g),dec);
==> 1
// size comparison:
size(string(f)) + size(string(g));
==> 4368
size(getStringpfd(dec));
==> 1055
| See also:
checkpfd;
displaypfd;
displaypfd_long;
evaluatepfd;
pfdMat.
|