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: Mon, 12 Nov 2007 21:32:52 -0500

On 11/12/07, Bill Page wrote:
>
> After looking at the Axiom source code I see that 'unparse' is
> actually internally calling functions which convert an expression in
> Axiom form to Fortran form. The necessary code is found here:
>
> http://wiki.axiom-developer.org/axiom--test--1/src/algebra/MkfuncSpad
> http://wiki.axiom-developer.org/axiom--test--1/src/interp/NewfortBoot
> http://wiki.axiom-developer.org/axiom--test--1/src/interp/FormatBoot
>
> But it isn't really necessary for you to understand all that. Here is
> a distillation of the important parts into a fairly simple function
> that I think probably does what you want:
>
> (1) -> output1d(e)== _
>   message( _
>     concat map(string,destruct _
>       fortranCleanUp( _
>         exp2Fort1( _
>           exp2FortOptimize( _
>             outputTran(e::INFORM)$Lisp _
>           )$Lisp _
>         )$Lisp _
>       )$Lisp _
>     ) _
>   )$OutputForm
>                                                    Type: Void
> (2) -> output1d(cos(x2) + 2*x1)
>    Compiling function output1d with type Expression Integer ->
>       OutputForm
> `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
>
>    (2)  cos(x2)+2*x1
>                                                    Type: OutputForm
> (3) ->
>

Oops, the version about fails for expressions like:

  output1d(x2/x2)

because of some additional unnecessary Fortran processing by
the routine 'outputTran'. Please use this slightly simpler version:

(1) -> output1d(e)== _
  message( _
    concat map(string,destruct _
      fortranCleanUp( _
        exp2Fort1( _
          exp2FortOptimize( _
            e::INFORM _
          )$Lisp _
        )$Lisp _
      )$Lisp _
    ) _
  )$OutputForm
                                                         Type: Void
(2) -> output1d(cos(x2) + 2*x1)
   Compiling function output1d with type Expression Integer ->
      OutputForm
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.

   (2)  cos(x2)+2*x1
                                                   Type: OutputForm
(3) -> output1d(x2/x1)
   Compiling function output1d with type Fraction Polynomial Integer
       -> OutputForm
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.

   (3)  x2/x1
                                                   Type: OutputForm
(4) -> output1d(sqrt(x1))

   (4)  x1**(1/2)
                                                   Type: OutputForm
(5) ->

-------------

I have recorded this issue at:

http://axiom-wiki.newsynthesis.org/401UnparseGeneratesFortranFunctionNames

since I think that really this is due to a bug in 'unparse'. It really
should not generate those Fortran-type names if it's purpose is really
to unparse Axiom commands in such a manner that they can be re-parsed
by the Axiom interpreter.

At the above link I also proposed a more general solution that
corrects this problem for other parts of Axiom as well.

Regards,
Bill Page.




reply via email to

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