Solutions containing RootOf , and the allvalues command
Consider solving a pair of equations,
and
with the
solve
command (I'll do a
restart
first so that all variables start unassigned):
>
restart;
sol := solve( {x+y = 2, x^2 + y^2 = 3}, {x, y} );
The output isn't quite what you expect---
x
and
y
should be numbers. But what
solve
tells us is quite simple: to solve the pair of equations above,
y
should be a root of the polynomial and
x
should be minus that same root plus 2. Maple uses the symbol "_Z" as the indeterminate (instead of the "
x
" or "
y
" you usually use as indeterminates) when it specifies a polynomial inside a
RootOf
expression.
The reason that Maple uses the
RootOf
notation instead of just printing out the numbers is that many equations, even simple equations, have solutions which are large and complicated if written out completely. The
RootOf
notation is an attempt to make things more compact and show the structure of the solution.
If you really need all the solutions written out completely, instead of in the more compact
RootOf
form, use the
allvalues
command:
> allvalues( sol );
And if you want floating point approximations to those numbers:
> evalf( allvalues(sol) );
But if you wanted floating point approximateions, you could have just started with fsolve (we'll talk more about it in the next Maple workshop) to get one of the points, or even both of the points if you give ranges for the x and y coordinates:
>
fsolve( {x+y = 2, x^2 + y^2 = 3}, {x, y} );
fsolve( {x+y = 2, x^2 + y^2 = 3}, {x = 0..1, y = 0..10} );
>