axiom-math
[Top][All Lists]
Advanced

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

Re: [Axiom-math] Axiom: Printing multiple variables in axiom.


From: Bill Page
Subject: Re: [Axiom-math] Axiom: Printing multiple variables in axiom.
Date: Sun, 11 Nov 2007 18:14:57 -0500

Why do you write 'unparse(y::INFORM)' ? Do you mean you literally want
to output a ' * ' character for multiplication? If so, I think there
must be a better way than this ...

On 11/11/07, Constantine Frangos <address@hidden> wrote:
>
> I am getting the result below for y.
>
> However, the output I actually want is:
>
> "cos(x2) + 2*x1"
>
> or even better,
>
> cos(x2) + 2*x1
>
> Is this possible ?
>
> Regards,
>
> C. Frangos.
>
>
> (42) -> y
> (42) ->
>    (42)  cos(x2) + 2x1
>                                                      Type: Expression Integer
> (43) -> unparse(y::INFORM)
> (43) ->
>    (43)  "DCOS(x2)+2*x1"
>                                                                  Type: String
> (44) -> unparse(y::INFORM)::OUTFORM
> (44) ->
>    (44)  "DCOS(x2)+2*x1"
>                                                              Type: OutputForm
> (45) ->
>
>
> On Saturday 10 November 2007 13:11, Martin Rubey wrote:
> > Constantine Frangos <address@hidden> writes:
> > > Hi Martin,
> > >
> > > Thanks for the reply. I tried your suggestion and this works perfectly -
> > > the inverted commas are ok.
> > >
> > > I tried your suggestion from a previous email to get axiom expressions in
> > > the form: 2*x1 instead of 2x1.
> >
> > why do you want to coerce the result of unparse (which is a string) to
> > OUTFORM? Note that unparse takes something of type InputForm,  so you'll
> > have to coerce y to INFORM before passing it to unparse.  The error message
> > is telling you exactly this.
> >
> > Martin
> >
> > > (9) -> y
> > > (9) ->
> > >    (9)  cos(x2) + 2x1
> > >                                                      Type: Expression
> > > Integer (10) -> unparse(y)::OUTFORM
> > >    There are no exposed library operations named unparse but there is
> > >       one unexposed operation with that name. Use HyperDoc Browse or
> > >       issue
> > >                              )display op unparse
> > >       to learn more about the available operation.
> > >
> > >    Cannot find a definition or applicable library operation named
> > >       unparse with argument type(s)
> > >                              Expression Integer
> > >
> > >       Perhaps you should use "@" to indicate the required return type,
> > >       or "$" to specify which version of the function you need.
> > > (10) ->
> > >
> > > On Friday 09 November 2007 20:41, Martin Rubey wrote:
> > > > Constantine Frangos <address@hidden> writes:
> > > > > In the function below, I tried to use the following commands
> > > > >
> > > > > )display value Acon
> > > > > print(['Acon = Acon])
> > > > >
> > > > > to print one or more variable.
> > > > >
> > > > > However, I get very strange behaviour and error messages, so had to
> > > > > comment them out. There might be a bug somwhere in my program.
> > > > >
> > > > > If an axiom expert could implement a simplified version of the Maxima
> > > > > display() function (probably a lisp function) in lisp/axiom, then
> > > > > this would be very useful.
> > > > >
> > > > > In Maxima:
> > > > >
> > > > >  x1:1;
> > > > >  x2:2;
> > > > >  x3:3;
> > > > >  display(x1,x2,x3); ->
> > > > >  x1 = 1
> > > > >  x2 = 2
> > > > >  x3 = 3
> > > >
> > > > Well, axiom functions always evaluate all it's arguments first.  So,
> > > > for debugging I usually use
> > > >
> > > > output ["x1: ", x1, " x2: ", x2]
> > > >
> > > > If you want cleaner output, you'll have to look into OutputForm. For
> > > > example, to print a string without the quotes, you can use
> > > > message$OUTFORM:
> > > >
> > > > (1) -> message("1")$OUTFORM
> > > >
> > > >    (1)  1
> > > >                                                              Type:
> > > > OutputForm
> > > >
> > > > At least for expressions there is a way to quote and unquote, but I
> > > > don't have it present right now.
> > > >
> > > > Martin
> > >
> > > --
>
>
> _______________________________________________
> Axiom-math mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/axiom-math
>




reply via email to

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