Lisp code from maxima calculation



Mike Beedle wrote:

> All,
> 
> I want to call Maxima, as a surrogate processor (interpreter), 
> for symbolic manipulation from Lisp, but then use these 
> results within a Lisp program.
> 
> Yes, I could call the Maxima functions directly but I think having 
> the full interpreter available will be a *great advantage*. 
> (Btw, is there an available translator from Maxima language 
> to Lisp and vice versa?)
The macsyma evaluator is called MEVAL.
You could "translate" to lisp as an alternative. This would
look like  (EVAL ($TRANSLATE ...))   which would run approximately
the same, but maybe faster if the function did a lot of
floating point (declared...)  arithmetic.  YOu could also
compile the translated code.
> 
> Contrast this to C/C++/COBOL/Java calling SQL; C calling 
> Clips; or Java calling Jess, etc.
> 
> The rationale for this architecture is that in my view of 
> the world, the Lisp program does many things -- one of 
> them which is calling Maxima and using its results.
> 
> So, ok, my questions are:
> 
> 	how do I fake that Maxima is initialized?
You load macsyma in to your lisp.  There is a set-up process
that depends to some extent on which lisp you are using.

> 	once this is done, how do I interface with from Lisp?

do you want the user to type in to the macsyma parser? or
do you expect to generate "macsyma-equivalent" data yourself?
If the latter, just use meval.

> 	lastly, how do I process its results in Lisp?

the results are lisp data.  e.g.  a+b  would look like

((mplus simp) $b $a)     for example.


> 
> Surely, someone else has already attempted this before,
> 
> ** Btw, my project is about finding symmetries in Lagrangians 
> for various field theories, and the computation of its 
> generating functionals, in terms of both algebraic 
> expressions and their numeric values.
> 
Unless your program is truly huge, the simplest solution is
generally to start up a macsyma / maxima system and load your
program into it.  Define a simple interface so macsyma can
call YOUR program,  eg  define

(defun $FINDSYMMETRY(x) ....)


which is called from within macsyma  by

(%i1) FINDSYMMETRY(....);


> Can someone point me in the right direction?

I hope this helps.


> 
> Advancethanks,
> 
> 
> - Mike
> http://www.physicsissoftware.com
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima