From: Robert D. <rob...@us...> - 2005-05-17 06:15:44
|
Update of /cvsroot/maxima/maxima/doc/info In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25493 Modified Files: Rules.texi Log Message: Additional material in tellsimpafter description. Still needs work. Index: Rules.texi =================================================================== RCS file: /cvsroot/maxima/maxima/doc/info/Rules.texi,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Rules.texi 15 May 2005 02:20:28 -0000 1.12 +++ Rules.texi 17 May 2005 06:15:35 -0000 1.13 @@ -619,9 +619,70 @@ @end deffn @deffn {Function} tellsimpafter (@var{pattern}, @var{replacement}) -defines a replacement for pattern -which the Maxima simplifier uses after it applies the built-in -simplification rules. The pattern may be anything but a single -variable or a number. +Defines a simplification rule which the Maxima simplifier +applies after built-in simplification rules. +@var{pattern} is an expression, comprising pattern variables (declared by @code{matchdeclare}) +and other atoms and operators, considered literals for the purpose of pattern matching. +@var{replacement} is substituted for an actual expression which matches @var{pattern}; +pattern variables in @var{replacement} are assigned the values matched in the actual expression. + +@var{pattern} may be any nonatomic expression +in which the main operator is not a pattern variable; +the simplification rule is associated with the main operator. +The names of functions (with one exception, described below), lists, and arrays +may appear in @var{pattern} as the main operator only as literals (not pattern variables); +this rules out expressions such as @code{foo(x)} and @code{bar[y]} as patterns, +if @code{foo} and @code{bar} are pattern variables. +Names of functions, lists, and arrays which are pattern variables may appear as operators +other than the main operator in @var{pattern}. + +There is one exception to the above rule concerning names of functions. +The name of a subscripted function in an expression such as @code{foo[a](x)} +may be a pattern variable, +because the main operator is not @code{foo} but rather the Lisp atom @code{mqapply}. +This is a consequence of the representation of expressions involving subscripted functions. + +@c LET'S NOT GO INTO DETAILS ABOUT MAIN OPERATORS HERE; BUT PRESERVE THIS FOR REFERENCE +@c The main operator of an expression @code{expr} is @code{caar $expr}. +@c For most kinds of expressions, +@c the main operator is the operator returned by @code{op (@var{pattern})}; +@c the sole exception is the operator @code{mqapply}, +@c which appears in indexed function expressions (e.g., @code{foo[i](x)}). + +@c NEED TO REVIEW THIS PARAGRAPH FOR ACCURACY +Simplification rules are applied after evaluation +(if not suppressed through quotation or the flag @code{noeval}). +Rules established by @code{tellsimpafter} are applied in the order they were defined, +and after any built-in rules. +Rules are applied bottom-up, that is, +applied first to parts of an expression before application to the whole expression. + +Pattern variables are treated as local variables in simplification rules. +Once a rule is defined, the value and other properties of a pattern variable +do not affect the rule, and are not affected by the rule. +An assignment to a pattern variables which results from a successful rule match +does not affect the current assignment (or lack of it) of the pattern variable. + +The treatment of noun and verb forms is slightly confused. @c THIS IS A BUG. +If a rule is defined for a noun (or verb) form +and a rule for the corresponding verb (or noun) form already exists, +the newly-defined rule applies to both forms (noun and verb). +If a rule for the corresponding verb (or noun) form does not exist, +the newly-defined rule applies only to the noun (or verb) form. + +See also @code{matchdeclare}, @code{defmatch}, @code{defrule}, @code{tellsimp}, and @code{let}. + +@code{tellsimpafter} quotes its arguments. +@code{tellsimpafter} returns the list of rules for the main operator of @var{pattern}, +including the newly established rule. +@c WHAT IS simpfoo THAT SOMETIMES APPEARS, AND WHY DOES false SOMETIMES APPEAR IN RETURN VALUE ?? + +Examples: +@c GENERATED BY: +@c matchdeclare (aa, atom, bb, atom_not0, [ll, mm], listp, [xx, yy], true)$ +@c tellsimpafter (ll^mm, map ("^", ll, mm)); +@c [a, b, c]^[1, 2, 3]; +@example +@end example @end deffn |