I am having a trouble with allvalues.
I have a result from solve containing RootOf. The Argument to the RootOf is a fourth order polynomial containing symbolic coefficients.
In my program, I need to run allvalues four times at a loop. Sometimes I can get the answers at first three, then get the error message at last one. Sometimes I only can finish first or second loop. I never get four complete answers.The error message are always the same:
Cannot evaluate Allvalues root sequence with symbolic coefficients.
The manual indicates that this error message happens with a RootOf with a fifth order (or higher) equation.
I recall reading that only sometimes is there a symbolic solution for a fourth-order equation. However, it appears that we can run allvalues one time on a fourth order equation and get a result.
Then, we try allvalues again on the exact same equation and get the above error message.
We are trying to characterize the problem–it’s happening inside a large program.
Is the allvalues routine using a random algorithm somewhere so that it will sometimes work and sometimes not work?
Maple release 3 will do this if you set the environmental variable _EnvExplicit to true eg
_EnvExplicit:=true
The general quartic will then solve for symbolic coefficients. I don’t
know whether this works when you have a RootsOf expression for the solution of an equation
but perhaps it will not give such expressions for quartic equations if the _EnvExplicit
is set
true.
_EnvExplicit
works in release 4 as well. Also, an alternativee to the _EnvExplicit
approach is to use the function, allvalues(). That is,
eq := a*x^4 + b*x^3 + c*x^2 +d*x + e: solve(eq,x): #produces RootOf(a*_Z^4+b*_Z^3+c*_Z^2+d*_Z+e) allvalues(%); #turns the RootOf into the full, explicit set of solutions
I have found that, at least in Maple V R4, you have to be very carefull when using symbolic solutions to the quartic equation. For instance, try the following:
1. get the roots of a polynomial x^4+a*x^3+b*x^2+c*x+d . 2. put a=b=c=0 and simplify. 3. put d=1 - after some massaging (using combine twice) you will get correct roots. 4. put d=-1 - immediately you get all roots equal to zero. Now try this: 1. get the roots of a plynomial x^4+a*x^3+b*x^2+c*x+d . 2. put a=b=c=0, d=-1 and simplify - Maple comes out with the following message: Error (in simplify/recurse) division by zero. 3. put a=0=c=0, d=1 and simplify - you will get complex expressions with radicals.
If you now use combine followed by simplify you will get roots as 1,-I,I,-1
which is
incorrect. If you instead try evaluate the said expressions in floating point you will get
correct answers.