# Singular          #### D.12.7.1 nrRootsProbab

Procedure from library `rootsmr.lib` (see rootsmr_lib).

Return:
int: the number of real roots of the ideal I by a probabilistic algorithm

Assume:
If I is not a Groebner basis, then a Groebner basis will be computed by using std. If I is already a Groebner basis (i.e. if attrib(I,"isSB"); returns 1) then this Groebner basis will be used, hence it must be one w.r.t. (any) global ordering. This may be useful if the ideal is known to be a Groebner basis or if it can be computed faster by a different method.

Note:
If n<10 is given, n is the number of digits being used for constructing a random characteristic polynomial, a bigger n is more safe but slower (default: n=5).
If printlevel>0 the number of complex solutions is displayed (default: printlevel=0).

Example:
 ```LIB "rootsmr.lib"; ring r = 0,(x,y,z),lp; ideal i = (x-1)*(x-2),(y-1)^3*(x-y),(z-1)*(z-2)*(z-3)^2; nrRootsProbab(i); //no of real roots (using internally std) ==> 9 i = groebner(i); //using the hilbert driven GB computation int pr = printlevel; printlevel = 2; nrRootsProbab(i); ==> //ideal has 32 complex solutions, counted with multiplicity ==> ********************************************************************* ==> * 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 * ==> ********************************************************************* ==> 9 printlevel = pr; ``` 