www.delorie.com/gnu/docs/calc/calc_276.html   search  
Buy the book!

GNU Emacs Calc 2.02 Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.11 Rewrite Rules

The a r (calc-rewrite) [rewrite] command makes substitutions in a formula according to a specified pattern or patterns known as rewrite rules. Whereas a b (calc-substitute) matches literally, so that substituting `sin(x)' with `cos(x)' matches only the sin function applied to the variable x, rewrite rules match general kinds of formulas; rewriting using the rule `sin(x) := cos(x)' matches sin of any argument and replaces it with cos of that same argument. The only significance of the name x is that the same name is used on both sides of the rule.

Rewrite rules rearrange formulas already in Calc's memory. See section 7.8.8 Syntax Tables, to read about syntax rules, which are similar to algebraic rewrite rules but operate when new algebraic entries are being parsed, converting strings of characters into Calc formulas.

11.11.1 Entering Rewrite Rules  
11.11.2 Basic Rewrite Rules  
11.11.3 Conditional Rewrite Rules  
11.11.4 Algebraic Properties of Rewrite Rules  
11.11.5 Other Features of Rewrite Rules  
11.11.6 Composing Patterns in Rewrite Rules  
11.11.7 Nested Formulas with Rewrite Rules  
11.11.8 Multi-Phase Rewrite Rules  
11.11.9 Selections with Rewrite Rules  
11.11.10 Matching Commands  
11.11.11 Automatic Rewrites  
11.11.12 Debugging Rewrites  
11.11.13 Examples of Rewrite Rules  

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003