axiom-developer
[Top][All Lists]

## [Axiom-developer] [#191 exquo and therefore gcd cannot handle UP(x, EXPR

 From: wyscc Subject: [Axiom-developer] [#191 exquo and therefore gcd cannot handle UP(x, EXPR INT)] Date: Wed, 13 Jul 2005 11:43:35 -0500

Changes
http://page.axiom-developer.org/zope/mathaction/191ExquoAndThereforeGcdCannotHandleUPXEXPRINT/diff
--

??changed:
-  In EXPR INT, $2^a$ and $2^(2a)$ are treated as two variables
In EXPR INT, $2^a$ and $2^{(2a)}$ are treated as two variables

??changed:
-Thus, in our case, at one point p1 is $4^a-2^(2a)$, which is zero
Thus, in our case, at one point p1 is $4^a-2^{(2a)}$, which is zero

??changed:
-From wyscc Mon Jul 11 18:08:28 -0500 2005
-From: wyscc
-Date: Mon, 11 Jul 2005 18:08:28 -0500
-Subject: Step by step works
>From billpage Wed Jul 13 00:47:27 -0500 2005
From: billpage
Date: Wed, 13 Jul 2005 00:47:27 -0500
Subject: $2^{{a2}}$ vs $4^a$

The problem seems to be that Axiom does not always treat $2^{a2}$
the same as $4^a$.

??changed:
-q:dom:=(x-2^a)*(x+2^a)
q:=(x-2^a)*(x+2^a)
qq:= simplify(q)
r:= q::dom
rr:= qq::dom

gcd(p,r)
gcd(p,qq)
gcd(p,rr)
q - qq
simplify q - qq
simplify ((r - rr)::EXPR INT)
t:Boolean:=(r = rr)

??changed:
-But note:
-\begin{axiom}
-simplify(q::EXPR INT)
-\end{axiom}
-
-From wyscc Mon Jul 11 19:39:36 -0500 2005
-From: wyscc
-Date: Mon, 11 Jul 2005 19:39:36 -0500
-Subject: Conclusion
-
-When done in step by step, Axiom does coerce 'r' correctly to what a normal
-user would expect. So the question is: why would it make a difference when
-everything is put on one line?
-
-My guess is that when the command is in one line, the arguments are evaluated
-first (supported by the sequence displayed with ')set mess bot on' ) and the
-coercion is done without the benefit of knowledge that 'gcd' is to be involved.
-Without this, the coercion from 'EXPR INT' to 'UP(x,EXPR INT)' is one from the
-[5 more lines...]

Martin wrote:
> I'm afraid that this cannot be fixed easily, since there is no
> general mechanism to determine whether an expression is zero or not,
> which is needed in exquo.

Your analysis seems to be the correct diagnosis. The problem has nothing to do
with 'gcd' or 'exquo', but with the fact that simplification is an art as there
is no canonical form for expressions and hence no way to test equality (which
is in general *different* from testing zero, a special case needed for
'exquo'). More frequent use of simplification will help but will not eliminate
the problem. Here, it is because the expressions $4^a$ and $2^{2a}$ are not
handled by an automatic simplification in 'UP(x, R)' (that is, not pushed down
to the level of 'R').

??changed:
-From billpage Wed Jul 13 00:47:27 -0500 2005
-From: billpage
-Date: Wed, 13 Jul 2005 00:47:27 -0500
-Subject: $2^{a2}$ vs $4^a$
-
-Notice the result of the simplification:
-\begin{axiom}
-p:=(x-2^a)::UP(x, EXPR INT)
-q:=simplify((x-2^a)*(x+2^a))::UP(x, EXPR INT)
-gcd(p, q)
-\end{axiom}
-Without the simplification:
-\begin{axiom}
-r:=((x-2^a)*(x+2^a))::UP(x, EXPR INT)
-gcd(p, r)
-\end{axiom}
-The problem seems to be that Axiom does not always treat $2^{a2}$
-the same as $4^a$.

--