Home Online Manual
Top
Back: coords
Forward: verify
FastBack:
FastForward:
Up: rootsmr_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

D.12.6.9 randcharpoly

Procedure from library rootsmr.lib (see rootsmr_lib).

Usage:
randcharpoly(b,i); randcharpoly(b,i,n); b,i ideal; n int

Return:
poly: the characteristic polynomial of a pseudorandom rational univariate projection having one zero per zero of i. If n<10 is given, it is the number of digits being used for the pseudorandom coefficients (default: n=5)

Assume:
i is a Groebner basis and b is an ordered monomial basis of r/i, r = basering

Note:
shows a warning if printlevel>0 (default: printlevel=0)

Example:
 
LIB "rootsmr.lib";
ring r = 0,(x,y,z),dp;
ideal i = (x-1)*(x-2),(y-1),(z-1)*(z-2)*(z-3)^2;
i = std(i);
ideal b = qbase(i);
poly p = randcharpoly(b,i);
p;
==> z8-1989306z7+1720335326522z6-844575738768293508z5+25739857498506957597394\
   5z4-49855396253842786126599566442z3+5991506449298102407845582886576172z2-\
   408335865183407651473343362162998177144z+12078261759575784323866334900781\
   464660123776
nrroots(p); // See nrroots in urrcount.lib
==> 6
int pr = printlevel;
printlevel = pr+2;
p = randcharpoly(b,i,5);
==> // poly, 9 monomial(s)
==> z8-2923964*z7+3712323518934*z6-2671920147197312780*z5+1191863249059288760\
   005489*z4-337242235263204293461543939056*z3+59079952041382728808956425746\
   100736*z2-5855367303472484622963975143953858560000*z+25120629313761950033\
   6395930918610534400000000
==> *********************************************************************
==> * WARNING: This polynomial was obtained using  pseudorandom numbers.*
==> * If you want to verify the result, please use the command          *
==> *                                                                   *
==> * verify(p,b,i)                                                     *
==> *                                                                   *
==> * where p is the polynomial I returned, b is the monomial basis     *
==> * used, and i the Groebner basis of the ideal                       *
==> *********************************************************************
nrroots(p);
==> 6
printlevel = pr;