Subject: Help to get started with the code of Maxima
From: Richard Fateman
Date: Mon, 24 Jun 2013 16:31:56 -0700
On 6/24/2013 4:02 PM, Samuel L? wrote:
> Hi!
>
> I'd like to start playing with Maxima's code. I suppose the maxima's
> software is organized as follow:
> 1. the maxima prompt takes the input from the user
> 2. it is passed to a lisp function that translates it into some LISP
> sexpr ( something like "derivative (x^2,x);" ->
> (some-function-for-derivative '(^x 2) 'x) )
> 3. it is evaluated (i.e (* 2 x))
> 4. it is translated back into standard notation (i.e "2*x") and
> passed back to the prompt.
>
> Please correct me if I am wrong. Now, what I'd like to do is to call
> the maths functions directly from Common Lisp (i.e access directly to
> "some-function-for-derivative" in my example). Is it possible to do so?
>
> Many thanks,
> Sam
>
>
yes. You should, however start thinking more "functionally" e.g.
(loop (display (evaluate (parse (readline)))))
not "taking stuff" or "passing stuff".
To see what that lisp sexpr is do this..
(%i1) diff(sin(x),x);
(%o1) cos(x)
(%i2) ?print(%i1)
note that ?print is the lisp print function.
You will see
(($DIFF SIMP) ((%SIN SIMP) $X) $X)
to see how lisp works on this, type on a command line..
(%i3) :lisp (meval '(($DIFF SIMP) ((%SIN SIMP) $X) $X) )
see also to_lisp().
meval is like lisp eval except it works on maxima expressions.
There is more info in this 1979 paper..
http://www.cs.berkeley.edu/~fateman/papers/simplifier.txt