realpart SciMax Toolbox rearray

SciMax Toolbox >> realroots

realroots

Maxima Function

Calling Sequence

realroots (expr, bound)
realroots(eqn,bound)
realroots(expr)
realroots(eqn)

Description

Computes rational approximations of the real roots of the polynomial expr or polynomial equation eqn of one variable, to within a tolerance of bound. Coefficients of expr or eqn must be literal numbers; symbol constants such as %pi are rejected.

realroots assigns the multiplicities of the roots it finds to the global variable multiplicities.

realroots constructs a Sturm sequence to bracket each root, and then applies bisection to refine the approximations. All coefficients are converted to rational equivalents before searching for roots, and computations are carried out by exact rational arithmetic. Even if some coefficients are floating-point numbers, the results are rational (unless coerced to floats by the float or numer flags).

When bound is less than 1, all integer roots are found exactly. When bound is unspecified, it is assumed equal to the global variable rootsepsilon.

When the global variable programmode is true, realroots returns a list of the form [x = x_1, x = x_2, ...]. When programmode is false, realroots creates intermediate expression labels %t1, %t2, ..., assigns the results to them, and returns the list of labels.

Examples:

(%i1) realroots (-1 - x + x^5, 5e-6);
                               612003
(%o1)                     [x = ------]
                               524288
(%i2) ev (%[1], float);
(%o2)                 x = 1.167303085327148
(%i3) ev (-1 - x + x^5, %);
(%o3)                - 7.396496210176905E-6
(%i1) realroots (expand ((1 - x)^5 * (2 - x)^3 * (3 - x)), 1e-20);
(%o1)                 [x = 1, x = 2, x = 3]
(%i2) multiplicities;
(%o2)                       [5, 3, 1]
realpart SciMax Toolbox rearray