[Maxima] expression parse tree API?
Mon Nov 27 11:17:24 CST 2006
On 11/27/06, Jurgis Pralgauskis <jurgpral at soften.ktu.lt> wrote:
> and maybe Maxima can show the inputed infix expression in the form of
> http://en.wikipedia.org/wiki/Polish_notation ?
It is easy enough to write such code in either Maxima or Lisp. The
following code converts to a string in parenthesized prefix notation:
pp(ex) := concat(if atom(ex) then ex
else concat(op(ex), "(", apply(concat, map(pp, args(ex))), ")"), ",")
pp( (1/sqrt(1-x^2)+1)*cos(asin(x)+x) ) =>
Removing the superfluous commas is left as an exercise for the reader.
More information about the Maxima