Subject: Assistance requested with basic Maxima commands.
From: Raymond Toy
Date: Wed, 13 Jul 2005 17:11:02 -0400
>>>>> "C" == C Frangos writes:
C> (1) Is it possible to synthesize a command to convert a string into a
C> valid expression, and then evaluate this using ev() ? The command
C> string(expr) does the opposite, converts an expression to a string.
Yes. Something like
(defun $foo (string)
(with-input-from-string (s string)
(dbm-read s)))
will produce the same form as if you had typed the string input the
prompt.
For this to all work, it needs to be made better, of course. I didn't
actually try $foo from maxima, but just ran it in lisp. So
(meval (third ($foo "sin(%pi/4): ")))
produces
((MTIMES SIMP) ((RAT SIMP) 1 2) ((MEXPT SIMP) 2 ((RAT SIMP) 1 2)))
which is maxima's internal representation of sqrt(2)/2.
Ray