axiom-mail
[Top][All Lists]
Advanced

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

[Axiom-mail] Re: [fricas-devel] Re: InputForm


From: Bill Page
Subject: [Axiom-mail] Re: [fricas-devel] Re: InputForm
Date: Wed, 3 Jun 2009 10:35:09 -0400

On Wed, Jun 3, 2009 at 10:20 AM, Martin Rubey wrote:
>
> Bill Page writes:
>> Note also that
>>
>>   y^2+x
>>
>> is not syntactically identical to the input
>>
>>   x+y^2
>>
>> I wonder why FriCAS changes the order?
>
> Because the semantics is the same.

Yes, thanks. Now I understand. In the expression:

  (x+y^2 )::INFORM

'(x+y^2 )' is first  fully interpreted by Fricas as a polynomial and
only then does it coerce (convert?) the result back to InputForm. To
do what I expected I guess one could write:

(1) -> unparse(parse("x+y^2")$InputForm)

   (1)  "x+y^2"
                                                                 Type: String

Then no semantics are involved but if invoke the interpreter explicitly

(2) -> unparse(interpret(parse("x+y^2")$InputForm)::INFORM)

   (2)  "y^2+x"
                                                                 Type: String

then of course I get the result you showed.

> Currently, + is always commutative I think, but compare:
>
> (18) -> a:XPOLY INT := y*x
>
>   (18)  y x 1
>                                    Type: XPolynomial(Integer)
> (19) -> b:POLY INT := x*y
>
>   (19)  x y
>                                    Type: Polynomial(Integer)
>
> well, embarassingly enough, there is no INFORM for XPOLY :-(
>

Of course there should be such a coercion.

You are right that the result depends on the domain chosen by the interpreter.

Regards,
Bill Page.




reply via email to

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