[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Re: EXPR POLY INT
From: |
Martin Rubey |
Subject: |
[Axiom-developer] Re: EXPR POLY INT |
Date: |
Tue, 15 Jun 2004 12:33:23 +0000 |
Dear William,
William Sit writes:
> So is this a bug? I am not sure, it may be good that the interpreter caught
> the
> ambiguity and it may be bad that the compiler does not. The compiler actually
> knows how to distinguish POLY INT from EXPR POLY INT even if the SAME symbol
> is
> used, but we (human) will get all confused. Try:
>
> )abb package TEST Test
>
> Test():Target==Implementation where
> EXPR ==> Expression
> POLY ==> Polynomial
> INT ==> Integer
> Target ==> with
> f1: () -> EXPR POLY INT
> f2: () -> POLY INT
> f3: () -> EXPR POLY INT
> f4: () -> EXPR POLY INT
> Implementation ==> add
> a:=new()$Symbol
> b:=a ::EXPR POLY INT
> c:=a :: POLY INT
> f1()==b
> f2()==c
> f3()== (c*b)/b
> f4()== f3()/b
>
> Note that if you check the signature of /, the compiler "knows" it is legally
> used and the answer for f4() is c/b, not 1 (which should be the case
> mathematically).
Well, I get the fraction %A / %A. I'm not to sure whether the reason for this
is, that axiom distinguishes the two %A's. I tried to find out why, however, I
couldn't: in expr.spad, we have the definitions
K ==> Kernel %
MP ==> SparseMultivariatePolynomial(R, K)
Rep := Fraction MP
if R has IntegralDomain then
x:% / y:% == reduc(x /$Rep y, commonk(x, y))
and
x:MP / y:MP ==
reduc(x /$Rep y,commonk0(algkernels variables x,algkernels variables y))
When saying f4()$TEST, the former gets called (twice, once for f3 too): The
first time x is %A %A and y is %A and x /$Rep y gives %A / %A, the second time,
x and y are both %A, and x /$Rep y gives %A / %A.
When I say a::EXPR INT/a, also the former gets called (once, of course),
x and y being a and x /$Rep y gives 1.
However, I was unable to find the definition which gets called for /$Rep. I
tried the definition in Fraction, and some others, to no avail...
More comments later
- [Axiom-developer] Bugs in combfunc.spad and partial patch, William Sit, 2004/06/10
- Re: [Axiom-developer] Bugs in combfunc.spad and partial patch, William Sit, 2004/06/10
- [Axiom-developer] Re: Bugs in combfunc.spad and partial patch, m.rubey, 2004/06/11
- [Axiom-developer] Re: Bugs in combfunc.spad and partial patch, William Sit, 2004/06/11
- Message not available
- Message not available
- Message not available
- Message not available
- [Axiom-developer] Re: EXPR POLY INT,
Martin Rubey <=
- Re: [Axiom-developer] Re: EXPR POLY INT, root, 2004/06/15
- [Axiom-developer] Re: EXPR POLY INT, William Sit, 2004/06/15
- [Axiom-developer] Re: EXPR POLY INT, Martin Rubey, 2004/06/15
- [Axiom-developer] Re: EXPR POLY INT, Martin Rubey, 2004/06/16
- [Axiom-developer] Re: EXPR POLY INT, root, 2004/06/16
- [Axiom-developer] Re: EXPR POLY INT, William Sit, 2004/06/17
- [Axiom-developer] Re: EXPR POLY INT, William Sit, 2004/06/16
- Message not available
- [Axiom-developer] Re: EXPR POLY INT, Martin Rubey, 2004/06/18
- Message not available
- Message not available
- [Axiom-developer] Re: EXPR POLY INT, Martin Rubey, 2004/06/18