How to make a simplifier



"If you know how to program in Lisp, it's not a big deal to write a 
simplification function. But let's hold off on that for the moment."

Why Lisp, Maxima's language is easier. I am not good at Lisp.

Rich



-----Original Message----- 
From: Robert Dodier
Sent: Tuesday, January 11, 2011 1:28 AM
To: Richard Hennessy
Cc: Maxima List
Subject: Re: [Maxima] How to make a simplifier

On 1/10/11, Richard Hennessy <rich.hennessy at verizon.net> wrote:

> I would like general information on how to make a simplifier for pw.  I 
> can
> get expressions in a complex form that can be simplified further but I don?t
> know how to write a simplifier.  Can someone point me in the right
> direction?

Rich, a "simplifier" in Maxima's world is just a function which
is called (by Maxima's general simplifier) to apply an identity to
an expression. Maxima associates a simplifier function with the
main (i.e. top-level) operator of the expression. So the simplifier
for pw expressions (assuming the operator is pw) is a function
associated with the symbol pw.

You can construct simplifier functions at the user level via
tellsimp and friends. The easiest case to handle is an operator
which has no built-in simplifications, and no evaluation function
(i.e. there is no pw(x) := ... nor (defun $pw (x) ...) for it).
Then you can do stuff

matchdeclare (xx, ... <some predicate function here> ...);
tellsimp (pw (xx), FOO (xx));

where FOO is a function which returns some transformed
version of pw (maybe still a pw expression or something else).

If pw takes a variable number of arguments, or if there is an
evaluation function, or you run into some other complication,
you might be better off programming in Lisp. If you know
how to program in Lisp, it's not a big deal to write a simplification
function. But let's hold off on that for the moment.

Hope this helps,

Robert Dodier