axiom-developer
[Top][All Lists]

## RE: [Axiom-developer] about Expression Integer

 From: Bill Page Subject: RE: [Axiom-developer] about Expression Integer Date: Mon, 20 Feb 2006 15:16:14 -0500

```On February 19, 2006 4:45 PM Martin Rubey wrote:
>
> Bill Page writes:
>
> >
> > > In other words, consider the following example:
> > > >   P := DistributedMultivariatePolynomial([x,y],Expression Integer)
> > > >   b := monomial(x,[0,0]::DirectProduct(2,NNI))\$P
> > > >

> ...
> I wrote that it could *lead* to "surprising" results. I.e.,
> I could imagine that some innocent looking computation would
> not be correct in the situation above. For example,
>
> differentiate(b+x,x)
>
> gives one, but
>
> differentiate(b+x,x)@EXPR INT
>
> gives two.

(1) -> P := DistributedMultivariatePolynomial([x,y],Expression Integer)

(1)  DistributedMultivariatePolynomial([x,y],Expression Integer)
Type: Domain

(2) -> b := monomial(x,[0,0]::DirectProduct(2,NNI))\$P

(2)  x
Type: DistributedMultivariatePolynomial([x,y],Expression Integer)

(3) -> differentiate(b+x,x)

(3)  1
Type: DistributedMultivariatePolynomial([x,y],Expression Integer)

(4) -> differentiate(b+x,x)@EXPR INT

(4)  2
Type: Expression Integer

> Note that I did not even need to ask to coerce b+x to EXPR INT...
> Of course, as we are discussing this now, this does not come as
> a surprise. But I bet that even for quite an experienced axiom
> user, who did not follow this thread for some reason, it will be
> difficult to spot the mistake. Especially if he doesn't realize
> that she wanted to compute something else...

I would call the result in (3) a bug. It seems to me that perhaps
'differentiate\$DMP' is making a unwarranted assumption that the
coefficients of DMP are constant. I cannot imagine a properp
mathematical definition of 'differentiate' that depended on the
distinction of polynomial coefficients versus variables.

>
> > Part of the reason for the confusion, I think, is because the
> > common OutputForm for polynomials does not typographically
> > identify polynomial variables versus coefficients. But if, say
> > the polynomial variables were always printed in bold face roman
> > type but the coefficients were printed in italic, it might be
> > more clear what is going on.
>
> I think that this is a very nice idee. I guess this could be
> even realized on text terminals, couldn't it?
>

To do this in LaTeX output is obviously quite straight forward.
To do it on text terminals I think would require support of
'curses' or a similar library. I am not sure that Axiom text
output (really a function of the underlying lisp - GCL, I guess)
supports 'curses'. Do you think suport for these conventions in
text output are really that important?

Regards,
Bill Page.

```