- p is a polynomial.
- I is an interval.

- numberroots rigorously computes the number of roots of polynomial the p in the interval I. The technique used is Sturm's algorithm. The value returned is not just a numerical estimation of the number of roots of p in I: it is the exact number of roots.
- The command findzeros computes safe enclosures of all the zeros of a function, without forgetting any, but it is not guaranteed to separate them all in distinct intervals. numberroots is more accurate since it guarantees the exact number of roots. However, it does not compute them. It may be used, for instance, to certify that findzeros did not put two distinct roots in the same interval.
- Multiple roots are counted only once.
- The interval I must be bounded. The algorithm cannot handle unbounded intervals. Moreover, the interval is considered as a closed interval: if one (or both) of the endpoints of I are roots of p, they are counted.
- The argument p can be any expression, but if Sollya fails to prove that it is a polynomial an error is produced. Also, please note that if the coefficients of p or the endpoints of I are not exactly representable, they are first numerically evaluated, before the algorithm is used. In that case, the counted number of roots corresponds to the rounded polynomial on the rounded interval *and not* to the exact parameters given by the user. A warning is displayed to inform the user.

1

> findzeros(1+x-x^2, [1,2]);

[|[1.617919921875;1.6180419921875]|]

2

> numberroots(x^2, [-1,1]);

1

> numberroots(x-pi, [0,4]);

Warning: the 0th coefficient of the polynomial is neither a floating point

constant nor can be evaluated without rounding to a floating point constant.

Will faithfully evaluate it with the current precision (165 bits)

1

> numberroots(1+x-x^2, [0, @Inf@]);

Warning: the given interval must have finite bounds.

Warning: at least one of the given expressions or a subexpression is not correctly typed

or its evaluation has failed because of some error on a side-effect.

error

> numberroots(exp(x), [0, 1]);

Warning: the given function must be a polynomial in this context.

Warning: at least one of the given expressions or a subexpression is not correctly typed

or its evaluation has failed because of some error on a side-effect.

error