HoldPattern
Usage
Notes
Further Examples
Arithmetic operations work on patterns in the same way as on any other symbolic entity.
In[1]:=
|
Out[1]=
|
Patterns are not considered to be special outside the context of the pattern matcher.
In[2]:=
|
Out[2]=
|
Use HoldPattern when you want to control the evaluation of patterns.
In[3]:=
|
Out[3]=
|
The defined function ff replaces sums of subexpressions of the form b[i] x[i] by z.
In[4]:=
|
In[5]:=
|
In[6]:=
|
In the numerator b[1] x[1] + b[2] x[2] is replaced by z but b[3] x[4] is left alone since the arguments of b and x are not the same.
In[7]:=
|
Out[7]=
|
In[8]:=
|
|