Home Online Manual
Top
Back: pfd
Forward: evaluatepfd
FastBack:
FastForward:
Up: pfd_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.15.12.2 checkpfd

Procedure from library pfd.lib (see pfd_lib).

Usage:
checkpfd(list(f,g),dec[,N,C]); f,g poly, dec list, N,C int

Return:
0 or 1

Purpose:
test for (mathematical) equality of f/g and a partial fraction decomposition dec. The list dec has to have the same structure as the output of pfd.
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.)
By default the test is done (exactly) by bringing all terms of the decomposition on the same denominator and comparing to f/g.
If additional parameters N [, C] are given and if N>0, a probabilistic method is chosen: evaluation at N random points with coordinates between -C and C. This may be faster for big polynomials.

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;
// partial fraction decomposition of f/g:
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)
==> 
// some other decomposition (not equal to f/g):
list wrong_dec = pfd(f+1,g);
==>   (1) / (q3*q4)
==> + (-1) / (q1*q4)
==> + (-1) / (q2*q3)
==> + (1) / (q1*q2)
==> + (-7) / (q3*q4^2)
==> + (1) / (q2*q4^2)
==> + (10) / (q1*q4^2)
==> + (1) / (q3^2*q4)
==> + (-1) / (q2*q3^2)
==> + (1) / (q3*q4^3)
==> + (-1) / (q2*q4^3)
==> + (1) / (q3*q4^4)
==> + (-1) / (q2*q4^4)
==> + (1) / (q3^2*q4^3)
==> where
==> q1 = x-1
==> q2 = y
==> q3 = x
==> q4 = x-y
==> (14 terms)
==> 
displaypfd_long(dec);
==>   (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)
==> 
list fraction = f,g;
// exact test:
checkpfd(fraction,dec);
==> 1
checkpfd(fraction,wrong_dec);
==> 0
// probabilistic test (evaluation at 10 random points):
checkpfd(fraction,dec,10);
==> 1
checkpfd(fraction,wrong_dec,10);
==> 0
See also: pfd.