axiom-developer
[Top][All Lists]
Advanced

[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: Wed, 16 Jun 2004 13:05:37 +0000

ok, now I understand what's the problem in Williams example:

)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

as you probably noted already:

(58) -> f1()$TEST::POLY INT
 
   Cannot convert from type Expression Polynomial Integer to Polynomial
      Integer for value
   %A

but

(59) -> f3()$TEST::POLY INT

   (59)  %A
                                                     Type: Polynomial Integer

Thus, in f1, (and b) the %A is a variable of the expression, in f3 it is a
coefficient of the expression. As you know, an expression is really a fraction
of SMPs, with variables being the "kernels" of the expression. So the
numerator of f1 (considered as fraction of SMPs) is the constant SMP %A, the
numerator of f3 (considered as fraction of SMPs) is the linear SMP in one
variable, which is %A.

It is quite clear, (as William noted), that this can only lead to trouble. So,
the real reason for EXPR POLY INT failing is, that the argument domain of EXPR
should be a domain without variables. 

For example, computing gcd(f1()$TEST,f3()$TEST) -- this is what happens in
f4()$TEST -- thus gives 1 instead of %A, f1()$TEST*f3()$TEST gives  %A %A
instead of %A^2 and so on.

I think there are two possibilities to fix this:

(1) provide a possibility to get the "variable free" domain of a domain, i.e.,

POLY INT, UP(x,POLY INT) both should yield INT

(2) make the coercion to EXPR smarter and swallow all variables...

I'm very unsure wether we should prefer (1) or (2), mainly because I still
don't understand the philosophy behind EXPR. Very briefly: I think we could
characterize EXPR R by saying that it is the space of functions whose variables
are allowed to take values in R or EXPR R. However, this is not quite complete:
In which domain are the numbers appearing in the expression?

For example

(7) -> 2.0*x^2*log(2*x)

             2
   (7)  2.0 x log(2.0 x)
                                                       Type: Expression Float

which is good, I believe. (Note that the square stayed square, not power 2.0)

Unfortunately I do not have browse, because I find it very difficult to imagine
other types and the example above is rather trivial. Maybe someone with the NAG
version could answer the following:

Are there domains with OrderedSet and IntegralDomain which are not
RetractableTo Integer?

All the best,

Martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]