axiom-developer
[Top][All Lists]

## [Axiom-developer] [DistributedMultivariatePolynomial] (new)

 From: hemmecke Subject: [Axiom-developer] [DistributedMultivariatePolynomial] (new) Date: Tue, 21 Feb 2006 04:56:30 -0600

Changes http://wiki.axiom-developer.org/DistributedMultivariatePolynomial/diff
--
The use of
\begin{axiom}
R := Expression Integer
\end{axiom}
as the coefficient domain in
\begin{axiom}
P := DistributedMultivariatePolynomial([x,y], R)
\end{axiom}
might lead to unexpected results due to the fact that the domain $R$ can
contain arbitrary expressions (including the variable $x$).
Take for example.
\begin{axiom}
a: P := x
b: P := a/x
\end{axiom}
Although it might seem strange that the result is not equal to 1,
Axiom behaved perfectly the way you told it to.

If the interperter sees $a/x$, it knows the type of $a$ but not yet for $x$. So
it looks for a function it can apply.
It finds that if x is coerced to $R$ (Expression Integer) than there is a
function in $P$, namely::

if R has Field then
(p : %) / (r : R) == inv(r) * p

By the way, in Axiom Expression Integer is considered to be a Field.
\begin{axiom}
R has Field
\end{axiom}

Thus $x$ is inverted (and now lies in $R$) and then multiplied with $a$.
There is no further simplification done.

The problematic thing is if the above expression ($a/x$) is not treated
carefully enough.
For example, by construction it should by now be clear that it has degree 1.
\begin{axiom}
degree b
\end{axiom}

And it should also be clear that the following two expressions result in
different output.
They are even stored differently in the internal structure of $P$.
\begin{axiom}
x*b
(x::R)*b
\end{axiom}
For the first expression, $x$ is converted to the indeterminate $x$ of the
polynomial ring $P$.
The interpreter finds an appropriate function::

*: (%, %) -> %

and applies it.

In the second case, it is explicitly said that $x$ has to be considered as an
element of $R$.
The interpreter finds the function with a more appropriate signature, namely::

*: (R, %) -> %

Be careful with something like that.
\begin{axiom}
d: P := x + (x::R)*1
\end{axiom}
>From the above discussion it should be clear that this expression is that what
>Axiom was told to do.

Now, a polynomial in $n$ variables is a function (with finite support)
from the domain of exponents $E=N^n$ (where $N$ is the non-negative integers)
to the domain $R$ of coefficients.

$$P = \bigoplus_{e \in E} R$$

With such an interpretation, $d$ has support
(i.e. the set of elements $e \in E$ for which the coefficient of $d$
corresponding to $e$ is non-zero)
$$\{ (1,0), (0,0) \}$$
and is therefore **not** equal to the polynomial $2x$ which has support
$$\{ (1,0) \}.$$

I Axiom is asked to convert $d$ to an arbitrary expression (Expression Integer),
it will convert both summands of $d$ to $R$ and as such they are, of course,
equal.
\begin{axiom}
d::R
\end{axiom}

--