Advice: Real values for a RootOf

Maple often returns solutions to various types of equations in terms of RootOf a polynomial. The allvalues function can be used to replace the RootOf with the roots of the polynomial. By default this will use symbolic solutions if that is possible (e.g. if the polynomial is of degree 4 or less). In many cases that may be inconvenient because the symbolic solutions are very complicated. In previous releases, numerical values were used when symbolic solutions were not available, but in Maple 6 these are replaced by indexed roots. You can use evalf to evaluate these. Note that this includes complex solutions. An alternative, which always returns floating-point results for real solutions, is to use fsolve as follows.

Examples:

> solve({ y^2+2*y+x=0, y = x^2 - 1 });

Save this in a variable:

> q:= %:

Isolate the RootOf :

> ro:= op(indets(q,RootOf));

Find a list of the real roots:

> rts:= [ fsolve(op(1,ro)) ];

Substitute into the solutions:

> map(t -> subs(ro=t,q), rts);

You could obtain complex solutions in the same way, using fsolve with the complex option:

> rts:= [ fsolve(op(1,ro), _Z, complex) ];

> map(t -> subs(ro=t,q), rts);

Here is the same calculation, done using allvalues . The implicit option prevents the use of the very complicated explicit solution of the quartic polynomial.

> allvalues(q,implicit);

> evalf([%]);

Maple Advisor Database R. Israel, 1997