Function: math[rootof] - solution of a RootOf expression
Calling Sequence:
rootof(expr);
rootof(expr, 'reals');
rootof(expr, 'reals', 'approx');
Parameters:
expr - any algebraic expression
Description:
The function tries to solve a RootOf expression symbolically. The result is a sequence of elements of type realcons. Since rootof internally uses solve to determine the result, expressions up to degree 4 can be solved explicitly.
If rootof can't solve a RootOf expression explicitly, it applies allvalues to the expression to compute a floating-point solution.
If the expression is not a RootOf expression, the expression is returned unevaluated.
By specifying the optional argument 'reals' or 'real', rootof only returns those solutions that are real but not complex.
In the third form, by passing both the 'real(s)' and 'approx' options, then rootof proceeds as follows: In complex values with imaginary parts b*I with b less than the global variable _MathEps these small imaginary parts are deleted (using math/cancel ), returning only their real parts.
This function is part of the math package, and so can be used only after performing the command with(math) or with(math, rootof).
Examples:
> with(math):
> r1 := RootOf(_Z^2-2*_Z-2);
> rootof(r1);
> r2 := RootOf(4*_Z^6-7*_Z^5-22*_Z^4-5*_Z^3+12*_Z^2+9*_Z+6);
> rootof(r2);
> rootof(r2, real);
> r := RootOf(20*_Z^4 + 32*_Z^3 - 111*_Z^2 - 124*_Z + 69);
> evalf(allvalues(r));
> rootof(r, reals, approx);
See Also:
solve , allvalues , RootOf .
Version History:
Version 1.0 as of January 01, 1998
Version 1.1 as of July 22, 2000