simp:false



Hello Chris,

> (1) Is it possible to perform only "steps" in the calculation.  That
> is to say, perform only one simplification at a time?

I don't know of any built-in way to enable a 1-step simplification mode.

If you are willing to do some programming, it is conceivable
to replace the function SIMPLIFYA to do something like
walk down a list of rules (see below) and return the result
of the first one which has some effect. Presumably the list
would change according to circumstances.

> (2) How would I go about writing a function which selectively
> simplified on some of the algebraic properties.

defrule creates a function which attempts to match a
pattern and replace it. matchdeclare specifies what are
pattern variables; everything not a variable is a literal.

Here is an example of how I think this ought to work (it doesn't).

  simp : false;
  not01p (x) := x # 0 and x # 1;
  matchdeclare (x, not01p);
  defrule (idempotent, 1*x, x);
  defrule (nilpotent, 0*x, 0);

  1*(a + 0*(b - c) - d); => 1*(a + 0*(b - c) - d);
   /* So far, so good. */
   apply1 (%, idempotent); => a + 0*(b - c) - d /* ought to be */
   apply1 (%, nilpotent); => a - d /* ought to be */

The apply1's actually cause indefinite looping; this is a
consequence of the algorithm by which a match is found
for a multiplicative term: divide out the literal factors and
see if the result = x. This is problematic if simp = false and
the literal factor is 1 or 0.
Try trace (idempotent); apply1 (foo, idempotent); .
(I mention this stuff mostly so I can find it again when
I file a bug report.)

If the defrule stuff sounds like it might be useful to you,
please let us know and I'll see if I can figure out how to
make defrule behave better.

Hope this helps,
Robert Dodier