Dear Doug,
there are two issues in your code:
Doug Stewart writes:
)clear all
digits 20
-- n:=x^3+a1*x^2+a2*x+a3 ::Polynomial Fraction Integer
Q:=(3*a2-a1^2)/9
R:=(9*a1*a2-27*a3-2*a1^3)/54
S:=(R+(Q^3+R^2)^(1/2))^(1/3)
T:=(R-(Q^3+R^2)^(1/2))^(1/3)
x1:=S+T-a1/3
note that x1 is *not* a polynomial. Not even a rational function.
However, if you *can* avoid this domain (often you can't), try to do so, since
it has a major drawback:
A computer cannot test reliably whether some element of Expression Integer is
zero or not. Axiom tries, but often fails. For example, the first example above
is not zero for Axiom...
(MuPAD, Mathematica and Maple try harder, but they often fail, too)
Note that this problem does not arise for many other domains: you can test for
zero in
Integer,
Polynomial Integer,
AlgebraicNumber,
PrimeField 5
Matrix Integer,
Fraction Polynomial PrimeField 1783
and so on.
Martin