lisp string to maxima expression



On 8/27/07, Yigal Asnis <yigalasnis at yahoo.com> wrote:

> I'm working on web site for interactive solving math problems using Lisp
> (clisp) as CGI.
>
> One thing I can't realize: I get Lisp input from CGI, say x^2+x+7. How can I
> convert it to Maxima expression for diff or solve?

Yigal, maybe the functions in share/contrib/eval_string.lisp are useful to you.
In Lisp you might do something like this:

;; assume s is bound to "x^2+x+7" or whatever
(load ($file_search "eval_string"))
;; just parse it
(format t "($parse_string ~s) => ~s~%" s ($parse_string s))
;; parse and evaluate it
(format t "($eval_string ~s) => ~s~%" s ($eval_string s))

I have just modified eval_string.lisp to accept Lisp strings as
well as Maxima strings. You can get the new version from CVS:
http://maxima.cvs.sourceforge.net/maxima/maxima/share/contrib/eval_string.lisp

Hope this helps,
Robert Dodier