SamplePublisher`GrassmannCalculus`
GCPushOnto |
|
| | ||||
|
| | ||||
|
| | ||||
Details and Options
Examples
(1)
Basic Examples
(1)
In[1]:=
<<GrassmannCalculus`
The Through function works well on simple sums.
In[2]:=
(f+g)[x]Through[%]
Out[2]=
(f+g)[x]
Out[2]=
f[x]+g[x]
But it does not work well for more complicated expressions because it does not reach to the operative functions. Nor is it easy to do a second Through that has the desired result.
In[3]:=
(3f-bDerivative[1][g])[x]Through[%]Through[#,Times]&/@%
Out[3]=
(3f-b)[x]
′
g
Out[3]=
(3f)[x]+(-b)[x]
′
g
Out[3]=
3[x]f[x]+(-1)[x]b[x][x]
′
g
With PushOnto we can push the x argument directly to f and g'.
In[4]:=
(3f-bDerivative[1][g])[x]%//
[f,Derivative[1][g]]
GCPushOnto |
Out[4]=
(3f-b)[x]
′
g
Out[4]=
3f[x]-b[x]
′
g
The following pushes multiple arguments.
In[5]:=
(3f-h-bDerivative[1,0,1][g])[x,y,z]%//
[f|h,Derivative[__][g]]
GCPushOnto |
Out[5]=
3f-h-b[x,y,z]
(1,0,1)
g
Out[5]=
3f[x,y,z]-h[x,y,z]-b[x,y,z]
(1,0,1)
g
Here is a linear expression of dyads to be evaluated on two vectors r and s. We can use GCPushOnto to push the arguments onto each direct product.
In[6]:=
(a1u⊗v+a2u⊗w+a3v⊗w)[r,s]%//PushOnto[{CircleTimes[__]}]
Out[6]=
(a1u⊗v+a2u⊗w+a3v⊗w)[r,s]
Out[6]=
a1(u⊗v)[r,s]+a2(u⊗w)[r,s]+a3(v⊗w)[r,s]
The following pushes the arguments only onto the functional part, h, of an operator. This form of PushOnto works wherever the specified argument list appears.
In[7]:=
(1+3x+h)[x,y,z]-f[(2+bh)[x,y,z]]%//
[{x,y,z},{h}]
2
y
GCPushOnto |
Out[7]=
-f[(2+bh)[x,y,z]]+(1+h+3x)[x,y,z]
2
y
Out[7]=
1+3x-f[2+bh[x,y,z]]+h[x,y,z]
2
y
The following pushes onto a function and derivatives of the function and then evaluates for a specific function.
In[8]:=
λh+Plus@@Table[(Derivative@@(2Part[IdentityMatrix[3],i]))[h],{i,3}]%[x,y,z]%//
[{h,Derivative[_,_,_][h]}]%/.hFunction[{x,y,z},Sin[x]Cos[y]Exp[-z]]//Simplify
GCPushOnto |
Out[8]=
hλ+++
(0,0,2)
h
(0,2,0)
h
(2,0,0)
h
Out[8]=
(hλ+++)[x,y,z]
(0,0,2)
h
(0,2,0)
h
(2,0,0)
h
Out[8]=
λh[x,y,z]+[x,y,z]+[x,y,z]+[x,y,z]
(0,0,2)
h
(0,2,0)
h
(2,0,0)
h
Out[8]=
-z
The following pushes onto pure functions. Here the pattern must allow for multiple arguments.
In[9]:=
3#1&+Function[{x,y},x+y][b,c]%//
[Function[__]]
2
#2
1
k
GCPushOnto |
Out[9]=
3#1&+[b,c]
2
#2
Function[{x,y},x+y]
k
Out[9]=
3b+
2
c
b+c
k
|
|
""

