SamplePublisher`GrassmannCalculus`
GCMapLevelPatterns |
|
| | ||||
Details and Options
Examples
(1)
Basic Examples
(1)
In[1]:=
<<GrassmannCalculus`
In[2]:=
f[1]+f[2]+f[3]+f[4]//
[g,{{f[_?EvenQ]}}]
GCMapLevelPatterns |
Out[2]=
f[1]+f[3]+g[f[2]+f[4]]
The following applies f to selected terms in a sum that occurs at position 1 in the expression.
In[3]:=
1/(a+b+c+d+e)%//
[f,{1,{a|d}}]
GCMapLevelPatterns |
Out[3]=
1
a+b+c+d+e
Out[3]=
1
b+c+e+f[a+d]
In the following we might only want to operate on the first two terms because any of the Trig or Simplify commands will also involve the third term if we apply them to the entire expression. Here we use various patterns to select the level parts.
In[4]:=
2
Sin[x]
2
Cos[x]
2
Tan[2x]
GCMapLevelPatterns |
2
Sin[_]
2
Cos[_]
Out[4]=
2
Cos[x]
2
Sin[x]
2
Tan[2x]
Out[4]=
1+2
2
Tan[2x]
In[5]:=
2
Sin[x]
2
Cos[x]
2
Tan[2x]
GCMapLevelPatterns |
Out[5]=
2
Cos[x]
2
Sin[x]
2
Tan[2x]
Out[5]=
1+2
2
Tan[2x]
In[6]:=
2
Sin[x]
2
Cos[x]
2
Tan[2x]
GCMapLevelPatterns |
Out[6]=
2
Cos[x]
2
Sin[x]
2
Tan[2x]
Out[6]=
1+2
2
Tan[2x]
The following applies a function to each of the square factors in a product.
In[7]:=
Sin[f[z]f[x-y]]%/.p:Power[f[_],2]g[p]
2
f[x]
2
f[y]
Out[7]=
Sin[f[x-y]f[z]]
2
f[x]
2
f[y]
Out[7]=
Sin[f[x-y]f[z]g[]g[]]
2
f[x]
2
f[y]
The following applies a function to the single product of all the square factors.
In[8]:=
Sin[f[z]f[x-y]]%//
[g,{1,{Power[f[_],2]}}]
2
f[x]
2
f[y]
GCMapLevelPatterns |
Out[8]=
Sin[f[x-y]f[z]]
2
f[x]
2
f[y]
Out[8]=
Sin[f[x-y]f[z]g[]]
2
f[x]
2
f[y]
|
|
""

