[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] [ExpressionInteger] (new)

From: hemmecke
Subject: [Axiom-developer] [ExpressionInteger] (new)
Date: Tue, 21 Feb 2006 16:04:05 -0600

Similar to the warning given for arguments of DistributedMultivariatePolynomial,
here is another warning about the use of Expression Integer.

Disclaimer: The page has been created to be helpful. 
But it might contain explanations that are based on misunderstandings
by the author. 
In any case the best source of information is the source code itself, but
since the Expression domain is quite complex, any attempt to document it well 
is welcome.

Expression Integer is a domain that is (like Polynomial Integer) mainly useful 
at the Axiom command line.
Roughly, any mathematical expression in Axiom can be converted to Expression 
Thus, although, Axiom currently does not forbid to construct other domains that 
use Expression Integer as a parameter,
such constructions should be done with utmost care since they might result in 
unexpected behaviour.

Take, for example, the domain constructor SparseUnivariatePolynomial.
According to its definition in src/algebra/poly.spad, it takes a ring $R$ as 
argument and constructs a 
univariate polynomial ring $P$ over $R$. In other words, if 
R := Expression Integer
P := SparseUnivariatePolynomial R
P = \bigoplus_{n\in N} R
where $N$ is the set of non-negative integers.
In particular, $P$ does not have any concept of a named indeterminate.
Axiom shows this by printing a question mark as the name of that indeterminate.
z: P := monomial(1, 1)

The following should come as no surprise.
a: P := x::P
b: Boolean := a=z
degree a
degree z

Let us analyze the assignment of $a$. 
The interpreter has to determine what to do with the letter $x$.
Obviously, the interpreter has no way to figure out that $x$ should be treated 
as the indeterminate of $P$.
It is clearly impossible, since the indeterminate of $P$ has no name.
The best thing the interpreter can to is to coerce $x$ to an element of $R$.
That is possible, since basically every mathematical expression is of type 
Expression Integer.
Now, coercing $x$ as an element of $R$ to $P$ is simple, since $R$ is the 
coefficient domain of $P$.
That explains also why the degree of $a$ is zero.

Since the $a$ is of degree zero, the following is also understandable.
differentiate a
differentiate z
Differentiation is done with respect to the only variable $P$ knows (namely the 
unnamed one).
That is the reason why differentiate does not need a second argument.

Now let us consider the following.
Each time we get 1 as a result. That is strange. It would be more appropriate 
if the first gives 1 and the other two give 0.
So let try to make it more obvious what happens.
Interestingly, the result tells us that in the first two cases differentiation 
is basically done in $R$
and the result is as we expect it to be. 
In the second two cases, the differentiation is basically equivalent to 
differentiation with respect to the unnamed indeterminate.
If this is not considered a bug, then it is at least an inconsistency with
b: Boolean := (x::P) = (y::P)

Then the following is also clear, but maybe not really as expected.

forwarded from

reply via email to

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