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: William Sit
Subject: [Axiom-developer] Re: EXPR POLY INT
Date: Wed, 16 Jun 2004 11:18:12 -0400

Hi Martin:

Your explanation on EXPR POLY INT is perfect.

> 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

Two comments: 

(1) Actually, there is a more general request for ages: that is, each
CONSTRUCTOR in Axiom should provide the means to return ALL the parameters. This
would have to be built like OutputForm form the bottom up because of nesting.
Lots of editing and a total rebuilt. Currently, when writing a constructor,
there is no way one can "descend" inside its parameters other than finding their
categorical property or attributes.

An argument against this is people may then write code that is not categorical.
But people can do anything they want anyway. The advantage is being able to
query about parameters can lead to more efficient code.

However, mathematically speaking, that is not the correct way to solve the
problem. The philosophy of Axiom is its generality. Thus EXPR R is a perfectly
good domain for any R in Join(OrderedSet, Ring) --- if ONLY EXPR could fake its
own name space for its kernel (er, variables or Symbol), which is equivalent
mathematically to taking transcendentals over R (from some universal extension,
say). This seems feasible and leads to my second comment.

(2) Note UP(x, POLY INT) is valid (in the interpreter) but not
POLY UP(x, INT) probably for the same reason as EXPR POLY INT. Now this should
be!

  )clear all
  a:POLY INT :=x
  b:UP('x,INT):='x
  differentiate(b,x)
  differentiate(b,a)
  b/a

Here one sees that just like TEST example in the compiler, the instantiation of
UP(x, POLY INT) creates internally a new symbol for 'x (but displays it as x)
separate from the x in POLY INT. In other words, UP has its own name space even
though the internal new symbol is still part of POLY INT. This trick of course
is used in all compilers to separate user variable from system variables. If the
new symbols are constructed randomly the chance of conflict is neglible. So, the
problem really lies with the user in choosing to DISPLAY results ambiguously.

On the other hand, why does the Interpreter behave differently for POLY UP(x,
INT) and UP(x, POLY INT)? The answer may lie in the fact that for POLY UP(x,
INT), the variable x is given, whereas in UP(x, POLY INT), no specific symbol is
given in POLY INT. It takes some deep tracing to see if this is true.

> 
> (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. 

Since POLY UP(x,INT) behaves similar to EXPR POLY INT, the former may be an
easier target to "fix".

Summary recommendation: All constructions should be allowed by creating suitable
name spaces to separate the computations. Users should not confuse themselves by
using the same variable name (for display) for the different name spaces.

> 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)

But notice that the 2 in 2*x has to be coerced to Float even though Float has
RetractableTo INT.

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

An integral domain of characteristic zero is always retractable to integer. On
the other hand, one of characteristic non-zero will contain a prime field which
is not an ordered set in Axiom (PrimeField has ContractableTo Integer and
RetractableTo(%), not RetractableTo Integer).

William
-- 
William Sit
Department of Mathematics..............Email: address@hidden
City College of New York..........................Tel: 212-650-5179
Convent Ave at West 138th Street..................Fax: 212-862-0004
New York, NY 10031............Axiom, A Scientific Computation Sytem
USA..........................http://www.nongnu.org/axiom/index.html




reply via email to

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