expression parse tree API?



and maybe Maxima can show the inputed infix expression in the form of 
http://en.wikipedia.org/wiki/Polish_notation ?
as I understand LISP thinks the prefix-way.. but the ?print  result 
looks too spagetti-like to me..

Thanks again.


Stavros Macrakis wrote:
> On 11/26/06, Jurgis Pralgauskis <jurgpral at soften.ktu.lt> wrote:
>> could smb point me how to access the formula parse tree.
>
> The internal form of Maxima expressions is a Lisp s-expression, which
> you can see using the ?print function.  For example,
>
>         sin(x)/x-x-1
>
> is represented as
>
>        ((MPLUS SIMP) -1
>                                    ((MTIMES SIMP) -1 $X)
>                                    ((MTIMES SIMP) ((MEXPT SIMP) $X -1)
>                                    ((%SIN SIMP) $X)))
>
> There are a few salient points here:
>
>  -- op(a) is represented as ((OP ...) a) The ... are various flags,
> most commonly SIMP indicating that the expression has already been
> simplified.
>  -- x/y is represented as x*y^-1
>  -- -x is represented as -1*x
>  -- there is a canonical ordering of terms in simplified expressions
>
> You can also access the operator and operands using the OP and ARGS
> functions in Maxima itself.  These normally reflect the *external*
> form of the expression, so op(-x)=> - (not *).  To see the internal
> forms, set inflag:true.
>
>              -s
>


-- 
Jurgis Pralgauskis
mob.: +37061677613; skype: dz0rdzas; (ICQ# 147307045 (retai tikrinu))
Don't worry, be happy :) and make things better ;)