up previous next
RealRoots    --    real roots of a univariate polynomial

RealRoots(F: RINGELEM, Precision: RAT): LIST
RealRoots(F: RINGELEM, Precision: RAT, Interval:[RAT, RAT]): LIST

This function computes isolating intervals for the real roots of a non-zero univariate polyomial over QQ . It returns the list of the real roots, where a root is represented as a record containing either the exact root (if the fields inf and sup are equal), or an open interval (inf, sup) containing the root. There is a third field (called CoeffList ) not intended for "public use".

An optional second argument specifies the maximum width an isolating interval may have. An optional third argument specifies a closed interval in which to search for roots.

The interval represented by a root record may be refined by using the function RealRootRefine .

The function RealRootsApprox may be easier to use: it produces rational approximations to the real roots (but these cannot later be refined).

/**/  use QQ[x];
/**/  indent(RealRoots(x^2-2));
  record[CoeffList := [-1, 0, 2], inf := -4, sup := 0],
  record[CoeffList := [1, 0, -2], inf := 0, sup := 4]

/**/  RR := RealRoots((x^2-2)*(x-1), 10^(-5));
/**/  FloatStr(RR[1].inf,10);  -- left end of interval

/**/  FloatStr(RR[1].sup,10);  -- right end of interval

/**/  RR := RealRoots(x^2-2, 10^(-20), [0, 2]);

/**/  FloatStr(RR[1].inf, 20);  -- comprehensible
/**/  RR[1].inf;                -- incomprehensible

See Also