[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 |
Changes http://wiki.axiom-developer.org/ExpressionInteger/diff
--
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
Integer.
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
\begin{axiom}
R := Expression Integer
P := SparseUnivariatePolynomial R
\end{axiom}
then
\begin{equation}
P = \bigoplus_{n\in N} R
\end{equation}
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.
\begin{axiom}
z: P := monomial(1, 1)
\end{axiom}
The following should come as no surprise.
\begin{axiom}
a: P := x::P
b: Boolean := a=z
degree a
degree z
\end{axiom}
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.
\begin{axiom}
differentiate a
differentiate z
\end{axiom}
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.
\begin{axiom}
differentiate(a,x)
differentiate(z,x)
differentiate(z,y)
\end{axiom}
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.
\begin{axiom}
differentiate(a^2,x)
differentiate(a^2,y)
differentiate(z^2,x)
differentiate(z^2,y)
\end{axiom}
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.
\begin{axiom}
differentiate(z^2)
\end{axiom}
If this is not considered a bug, then it is at least an inconsistency with
\begin{axiom}
b: Boolean := (x::P) = (y::P)
\end{axiom}
Then the following is also clear, but maybe not really as expected.
\begin{axiom}
differentiate(z^2*a^3,x)
differentiate(z^2*a^3,y)
\end{axiom}
--
forwarded from http://wiki.axiom-developer.org/address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Axiom-developer] [ExpressionInteger] (new),
hemmecke <=