I don’t understand how to manage *nested* extension fields. Typical example:
>alias(alpha = RootOf(X^2-2)) ; I alpha > alias(beta = RootOf(X^2-alpha)) ; Error, (in RootOf) expression independent of, _Z
Why this error ? Of course I try to replace X by the system _Z:
> alias(beta = RootOf(_Z^2-alpha)) ; I alpha beta > evala(beta^4) ; alpha^2
Obviously the answer should be 2 ; this looks like if only the beta-definition is considered. Still more strange, this works :
> evala(alpha^2) ; 2
But neither this:
> evala(evala(beta^4)) ; alpha^2 nor this: > evala(beta^4) ; evala(%) ; alpha^2 alpha^2
The explanations in the documentation about Primfield, evala, ... are not concerned
by examples of this type. Of course in my example it would be sufficient to give
alias(beta = RootOf(X^4-2))
, but I’m in fact interested by much more complicated
situations.
Your problem stems from an alias defined in terms of another alias.
Maple states in the help page for alias as follows:
“The arguments to alias are equations. When alias is called, the equations are evaluated from left to right, but are not subjected to any existing aliases. Therefore, you cannot define one alias in terms of another. Next, the aliases are defined. Finally, a sequence of all existing aliases is returned as the function value.”
Thus it is not allowed.
However, I think it would be better if Maple returned an error message to make this clear.
The problem is the way alias works.
A fix (not explained) is this
> nestalias := proc() alias(args) end; nestalias := proc() alias(args) end > nestalias(alpha = RootOf(X^2-2)) ; I, alpha > nestalias(beta = RootOf(X^2-alpha)) ; I, alpha, beta > evala(beta^4); 2
Note, you can’t use nestalias to turn off or change an alias.
The following may solve your problem:
> restart; > alias(alpha=RootOf(X^2-2)); I, alpha > alias(beta=RootOf(X^2-RootOf(X^2-2))); I, alpha, beta > map(evala,[alpha^2-2,beta^4-2]); [0, 0]
Michael Monagan wrote: ...
That’s a very nice trick, really. If I correctly understand it, then one has to delay executing alias():
> restart; > alias(alpha=RootOf(X^2-2)); I, alpha > eval('alias'(beta=RootOf(X^2-alpha))); I, alpha, beta > evala(alpha^2); 2 > evala(beta^4); 2
Thus you don’t have to spend another procedure name.