With the most recent revision of FriCAS (Rev: 393) plus the patch that
I recently posted, FriCAS produces the following output:

    (1) -> sqrt(2)::InputForm + 1::InputForm

       (1)  (+ (:: (** 2 (/ 1 2)) (AlgebraicNumber)) 1)
                                                    Type: InputForm
    (2) -> unparse(%)

       (2)  "(2^(1/2))::AlgebraicNumber+1"
                                                    Type: String
    (3) -> parse(%)$InputForm

       (3)  (+ (:: (^ 2 (/ 1 2)) AlgebraicNumber) 1)
                                                    Type: InputForm
    (4) -> interpret(%)$InputForm

             +-+
       (4)  \|2  + 1
                                                    Type: AlgebraicNumber
    (5) -> %::InputForm

       (5)  (:: (+ (** 2 (/ 1 2)) 1) (AlgebraicNumber))
                                                    Type: InputForm

-----

I have a few questions about the InputForm values produced in different ways.

1) Use of coercions and types in InputForm. As far as I know, besides
it's use in

    (6) -> integrate(sin(exp x),x)::InputForm

       (6)  (integral (sin (exp x)) (:: x Symbol))
                                                    Type: InputForm
    (7) -> unparse %

       (7)  "integral(sin(exp(x)),x::Symbol)"
                                                    Type: String

this change introduces the first use of :: for representing explicit
type information in InputForm.

What do you think about this approach? Is there a better way?

One alternative would be to introduce a specific (non-overloaded)
operation exported by AlgebraicNumber such as 'algebraicNumber' that
does the same thing. That is how Float values are currently handled:

    (8) -> 3.141592::InputForm

       (8)  (float 231808574432053350722 - 66 2)
                                                    Type: InputForm
    (9) -> unparse %

       (9)  "float(231808574432053350722,-66,2)"
                                                    Type: String

Would doing something like this:

   (algebraicNumber (** 2 (/ 1 2)))

be better?

One of the uses of unparse output will be to produce input for other
systems (usually used only internally in some interface program) such
as Sage. Will this use of :: cause any inconvenience for such use? How
will we/can we translate this into Sage coercions?

2) Notice that the InputForm value representing the same expression
occur with both ** and ^. Which one is currently the preferred form?

3) I would like to collect examples of coercions to InputForm fail in the sense

    (10) -> test(interpret(parse(unparse(x::InputForm))$InputForm) = x)

       (10)  true
                                                    Type: Boolean

Any help appreciated.

Regards,
Bill Page.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to