[Top][All Lists]

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

RE: [Axiom-developer] Re: "Factoring" Expression Integer/ simplifyingpow

From: Page, Bill
Subject: RE: [Axiom-developer] Re: "Factoring" Expression Integer/ simplifyingpowers (an example)
Date: Mon, 6 Mar 2006 19:43:54 -0500

On Monday, March 06, 2006 6:42 AM Martin Rubey wrote:
> ...
> Francois Maltey wrote:
> > // Is it an axiom bug in axiom ?
> >   I don't understand why (x+y+1)^2 ::DMP([x],Integer) gives me an 
> >   Expression Integer, not an error.  //
> Well, even (x+y+1)^2 ::DMP([x,y],Integer) gives an EXPR INT. 
> The reason is, that :: has a very high precedence. So you are
> converting 2 to a DMP([x],INT) -- or a DMP([x,y], INT) -- and
> then you compute (1+x+y) to the power of that polynomial...

Hmmm... that is interesting.

(1) -> x^1

   (1)  x
   Type: Polynomial Integer

Ok, here the interpreter finds ^:(%,NNI)->% in 'Polynomial Integer'.

(2) -> x^(1::POLY INT)

   (2)  x
   Type: Expression Integer

So, here the interpreter finds ^:(%,%)->% in 'Expression Integer',
and the coercion POLY INT -> EXPR INT, just like this:

(3) -> x^(y::POLY(INT))

   (3)  x
   Type: Expression Integer

But how can we explain these results?

(4) -> x^(1::DMP([x],Integer))

   (4)  x
   Type: Fraction Polynomial Integer

(5) -> x^(1::SUP(INT))

   (5)  x
   Type: Expression SparseUnivariatePolynomial Integer

And why not this?

(6) -> x^(y::DMP([y],INT))
   There are 4 exposed and 0 unexposed library operations named ^
      having 2 argument(s) but none was determined to be applicable.
      Use HyperDoc Browse, or issue
                                )display op ^
      to learn more about the available operations. Perhaps
      package-calling the operation or using coercions on the arguments
      will allow you to apply the operation.

   Cannot find a definition or applicable library operation named ^
      with argument type(s)
                                 Variable x

      Perhaps you should use "@" to indicate the required return type,
      or "$" to specify which version of the function you need.

Bill Page.

reply via email to

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