newbie questions about maxima internals



Replies in-line.

On Thu, Nov 8, 2012 at 3:02 PM, Jean-Claude Arbaut <
jeanclaudearbaut at orange.fr> wrote:

> ...Then, I can use meval on maxima expressions written as list, and with
> a: ...;
> :lisp $a
> I can see how expression are coded.
>

Yes, you can also call ?print(a) from within Maxima code.


> Now the question:
> expression are often of the form((op simp) arg ...)
>

More generally, they are of the form

       ((op <flag>...) <arg> ... )

>
> However, I can run meval simply on '(op arg ...), and hte result seems to
> be the same.
> So what's the difference ?
>

meval accepts the form (op arg...) and converts it to ((op) arg...).  This
was probably some sort of convenience or backwards-compatibility hack at
the dawn of time. Other parts of Maxima do not allow this form and you
should never use it.


> Also, with for example (meval '($factor (mplus 1 $x (mtimes $x $x) (mtimes
> $x $x $x))))
> I get forms with (op simp factored), (op simp irreducible) and (op simp
> ratsimp).
>
> How does maxima work with symbols added to the operator ?
>

Flags can be added to the car.  The only ones that are widely recognized
and used by Maxima are simp (marks the expression as simplified) and array
(indicates that this is a subscripting expression, not a function call),
e.g. ((a) 1) == a(1) and ((a array) 1) == a[1]


> Also, when trying
> a:'expand((x+y)^2);
> :lisp $a
>
> I get (%expand simp) instead of ($expand simp). What's the difference ?
>

This is the so-called noun/verb scheme.  A function call f(x) is normally
(($f) $x), while 'f(x) is ((%f) x).  This becomes especially important for
things like diff, integrate, and limit, which are names both for a
declarative concept ("the derivative of sin(x) with respect to x") and an
imperative concept ("take the derivative of sin(x) with respect to x").


> Finally, is there some documentation about maxima internals ?


Not much.  But this has some pointers: http://bit.ly/PHAMn8

         -s