Changes
http://wiki.axiom-developer.org/382DivideIfCanUnivariatePolynomialDivisionPackageAlgorithm/diff
--
Yes, the coefficient domain should be an 'IntegralDomain' but the expected
message would have been that 'divideIfCan' is not implemented in
'UP(x,ZMOD(9))'. As this is Axiom, what happened is far more complicated than
that. Note that both 'a' and 'b' are of type 'POLY ZMOD(9)', not
'UP(x,ZMOD(9))'. Not finding 'divideIfCan' in 'POLY ZMOD(9)', the Interpreter
coerces 'a' and 'b' to 'UP(x,ZMOD(9))'. Again, not finding 'divideIfCan' in
'UP(x,ZMOD(9))', both 'a' and 'b' are coerced into 'UP(x,INT)' and the failure
occurred there. The sequence of coercion selected depends very much on the
original types of 'a' and 'b' as well as the computing environment at the time
(compare the two batches, the second is a re-creation of the original; order in
the batches is important, that is, whether '(UP(x,ZMOD(9))' is exposed and
instantiated or not) and I can only characterize it as, in TeX parlance,
*fragile*. Note that even if '5*a' is obviously divisible by 'a', after
coercion, exact d!
ivision may not hold! There is a big difference between 't' and 's'.
\begin{axiom}
a:=5*x^7+3::ZMOD(9)
aa:UP(x,ZMOD(9)):= 5*x^7+3
b:=2*x^3+7::ZMOD(9)*x
bb:UP(x,ZMOD(9)):= 2*x^3+7*x
)set mess bot on
u:=divideIfCan(a,b)
typeOf u
)set mess bot off
v:=divideIfCan(aa,bb)
t:=divideIfCan(5*a,a)
typeOf t
s:=divideIfCan(5*(a::UP(x,INT)),a)
\end{axiom}
Compared this with (the original reported environment):
\begin{axiom}
)expose UnivariatePolynomialDivisionPackage
recip(2::ZMOD(9))
a:=5*x^7+3::ZMOD(9)
aa:UP(x,ZMOD(9)):= 5*x^7+3
b:=2*x^3+7::ZMOD(9)*x
bb:UP(x,ZMOD(9)):= 2*x^3+7*x
)set mess bot on
u:=divideIfCan(a,b)
typeOf u
)set mess bot off
v:=divideIfCan(aa,bb)
t:=divideIfCan(5*a,a)
typeOf t
s:=divideIfCan(5*(a::UP(x,INT)),a)
\end{axiom}
--
forwarded from http://wiki.axiom-developer.org/[EMAIL PROTECTED]