1Function: polrootsreal
2Section: polynomials
3C-Name: realroots
4Prototype: GDGp
5Description:
6  (gen,?gen):vec:prec realroots($1, $2, $prec)
7Help: polrootsreal(T, {ab}): real roots of the polynomial T with real
8 coefficients, using Uspensky's method. In interval ab = [a,b] if present.
9Doc: real roots of the polynomial $T$ with real coefficients, multiple
10 roots being included according to their multiplicity. If the polynomial
11 does not have rational coefficients, it is first rescaled and rounded.
12 The roots are given to a relative accuracy of \kbd{realprecision}.
13 If argument \var{ab} is
14 present, it must be a vector $[a,b]$ with two components (of type
15 \typ{INT}, \typ{FRAC} or \typ{INFINITY}) and we restrict to roots belonging
16 to that closed interval.
17 \bprog
18 ? \p9
19 ? polrootsreal(x^2-2)
20 %1 = [-1.41421356, 1.41421356]~
21 ? polrootsreal(x^2-2, [1,+oo])
22 %2 = [1.41421356]~
23 ? polrootsreal(x^2-2, [2,3])
24 %3 = []~
25 ? polrootsreal((x-1)*(x-2), [2,3])
26 %4 = [2.00000000]~
27 @eprog\noindent
28 The algorithm used is a modification of Uspensky's method (relying on
29 Descartes's rule of sign), following Rouillier and Zimmerman's article
30 ``Efficient isolation of a polynomial real roots''
31 (\url{http://hal.inria.fr/inria-00072518/}). Barring bugs, it is guaranteed
32 to converge and to give the roots to the required accuracy.
33
34 \misctitle{Remark} If the polynomial $T$ is of the
35 form $Q(x^h)$ for some $h\geq 2$ and \var{ab} is omitted, the routine will
36 apply the algorithm to $Q$ (restricting to nonnegative roots when $h$ is
37 even), then take $h$-th roots. On the other hand, if you want to specify
38 \var{ab}, you should apply the routine to $Q$ yourself and a suitable
39 interval $[a',b']$ using approximate $h$-th roots adapted to your problem:
40 the function will not perform this change of variables if \var{ab} is present.
41