MATCH INDEX

MATCH _ _ _ _ _ _ _ _ _ _ _ _ command

The match command is similar to the let command, except that it matches only explicit powers in substitution.

syntax:

match<expr> = <expression>{,<expr> =<expression>}*

<expr> is generally a term involving powers, and is limited by the rules for the let command. <expression> may be any valid REDUCE scalar expression.

examples:


match c**2*a**2 = d;
(a+c)**4; 

   4       3          3    4
  A   + 4*A *C + 4*A*C  + C  + 6*D 


match a+b = c; 

a + 2*b; 

  B + C 


(a + b + c)**2; 

   2     2               2
  A   - B   + 2*B*C + 3*C  


clear a+b; 

(a + b + c)**2; 

    2                    2            2
  A   + 2*A*B + 2*A*C + B  + 2*B*C + C  


let p*r = s; 

match p*q = ss; 

(a + p*r)**2; 

   2            2
  A  + 2*A*S + S  


(a + p*q)**2; 

   2              2  2
  A   + 2*A*SS + P *Q

Note in the last example that a + b has been explicitly m atched after the squaring was done, replacing each single power of a by c - b. This kind of substitution, although following the rules, is confusing and could lead to unrecognizable results. It is better to use match with explicit powers or products only. match should not be used inside procedures for the same reasons that let should not be.

Unlike let substitutions, match substitutions are ex ecuted after all other operations are complete. The last example shows the difference. match commands can be cleared by using clear, with exactly the expression that the original match took. match commands can also be done more generally with for all or forall...such that commands.