Ask for the syntax of representing operators in Common-Lisp



Maxima "translated" code does not correspond, in general to unadorned Lisp
(or fortran either). It works only if it is read back into Maxima.

If all you are interested in are the operators +, - , *, /, and a few others
like sin, cos, sqrt... maybe it makes sense to read it back into plain Lisp.

But Common Lisp does not have operators that correspond to user-defined
functions, nor more advanced stuff. Just to pick some names from recent
mail, binomial, factorial, elliptic integrals.

  Someone writing a Maxima utility to convert to stand-alone Lisp would have
to do a very elaborate program to cover "everything" that Maxima knows how
to evaluate numerically, or just do a hack job that would work for
demonstration purposes (and maybe work well enough for you.)

Converting code that has "binomial" in it to fortran isn't going to work
either, so by my previous statement it must be that the fortran() command is
just a hack. Yep.

If you are using lisp for numerical code, why not keep Maxima in that lisp
too?  (Maxima's probably smaller than your browser.) Then you could use
translate.  Maybe tell us more about what you are doing? Do you have the
"killer app" for Maxima -- generating numerical code for something that lots
of people want to run on their Lisp systems?

Good luck

RJF


-----Original Message-----
From: maxima-admin at math.utexas.edu [mailto:maxima-admin at math.utexas.edu] On
Behalf Of Daniel Lakeland
Sent: Tuesday, July 11, 2006 6:25 PM
To: Maxima mailing list
Subject: Re: [Maxima] Ask for the syntax of representing operators in
Common-Lisp

On Tue, Jul 11, 2006 at 08:05:44PM -0500, Barton Willis wrote:
> Place your code in a file and use the function 'translate_file.'
> 
> Barton

I found this when I went digging after sending the previous
email. However I noticed that the code produced does not correspond to
regular lisp code. 

It seems that translate and translate_file are intended to take maxima
code and produce lisp code that is equivalent to the maxima code. What
I was hoping for was something closer to what the "fortran" function
does. Consider a maxima expression as a mathematical expression and
convert it to the straightforward common lisp expression.

It's sort of funny that maxima can do this for fortran, but apparently
not for lisp...

eg:

common_lisp((a*x^2+b*x+c)/(1+sin(x))) =>
(lambda (a b c x) (/ (+ (* a  (expt x 2)) (* b x) c) (+ 1 (sin x))))

Having this kind of functionality would be a big help to those trying
to use maxima to get analytical results for use in numerical lisp
code. 

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima