|
|
last edited 7 years ago by test1 |
1 2 3 4 5 6 | ||
Editor: kratt6
Time: 2007/12/20 01:07:34 GMT-8 |
||
Note: |
added:
From kratt6 Thu Dec 20 01:07:34 -0800 2007
From: kratt6
Date: Thu, 20 Dec 2007 01:07:34 -0800
Subject:
Message-ID: <20071220010734-0800@axiom-wiki.newsynthesis.org>
Category: Axiom Compiler => Axiom Library
Status: None => transferred
gcd((x-2^a)::UP(x,EXPR INT), simplify((x-2^a)*(x+2^a))::UP(x, EXPR INT))
(1) |
Gives 1, while the correct answer should be , as given by
gcd((x-2^a)::UP(x,EXPR INT), ((x-2^a)*(x+2^a))::UP(x, EXPR INT))
(2) |
gcd((x-2^a)::UP(x, EXPR INT), simplify((x-2^a)*(x+2^a))::UP(x, EXPR INT))
gives 1, while the correct answer should be x-2^a, as given by
gcd((x-2^a)::UP(x, EXPR INT),((x-2^a)*(x+2^a))::UP(x, EXPR INT))
A workaround is presented on [EXPR_GCD]?
In EXPR INT, and are treated as two variables without relations in EXPR INT. Therefore exquo in::
gcdPrimitive(p1:SUPP,p2:SUPP)$PGCD
fails.
Thu 09/30/2004 at 09:31, comment #3
Excuse me, I was to quick again. Here is the (hopefully correct) anaylysis:
exquo(simplify((A-2^a)*(A+2^a))::UP(A,EXPR INT),(A-2^a)::UP(A,EXPR INT))
calls exquo$SUP(EXPR INT)
. This implements exact division of
polynomials p1 by p2 as usual. After each subtraction - done via
fmecg$SUP
- the result is again stored in p1. exquo terminates
when p1 is the empty list - note that SUPs? are stored as lists
of pairs (degree, coefficient) - or the degree of p2 is larger
than p1. In the latter case, exquo fails.
Thus, in our case, at one point p1 is , which is zero mathematically, but axiom does not know it. In particular, p1 is not the empty list, but rather a constant polynomial...
It would be interesting to see how MuPAD? or Aldor handle this.
Martin Rubey
The instance of exquo involved is the one in SMP.
Sorry, this is not correct. It is in FIELD (for EXPR INT)
Martin Rubey
I should have added:
exquo(normalize(simplify(((A-2^a)*(A+2^a)))::EXPR INT),normalize((A-2^a)::EXPR INT))
(3) |
exquo(simplify((A-2^a)*(A+2^a))::UP(A,EXPR INT), (A-2^a)::UP(A, EXPR INT))
(4) |
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. The instance of exquo involved is the one in SMP.
The problem seems to be that Axiom does not always treat the same as .dom:=UP('x,EXPR INT)
(5) |
p:dom:=x-2^a
(6) |
q:=(x-2^a)*(x+2^a)
(7) |
qq:= simplify(q)
(8) |
r:= q::dom
(9) |
rr:= qq::dom
(10) |
gcd(p,q)
(11) |
exquo(q,p)
(12) |
gcd(p,r)
(13) |
gcd(p,qq)
(14) |
gcd(p,rr)
(15) |
q - qq
(16) |
simplify q - qq
(17) |
simplify ((r - rr)::EXPR INT)
(18) |
t:Boolean:=(r = rr)
(19) |
Comments from wyscc:
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 and are not handled by an automatic simplification in UP(x, R)
(that is, not pushed down to the level of R
).