SamplePublisher`GrassmannCalculus`
ContractInteriorProducts |
|
| | ||||
Details and Options
Examples
(2)
Basic Examples
(2)
In[1]:=
<<GrassmannCalculus`
In[2]:=
SetActiveSpacePreferences |
PublicGrassmannAtlas |
Here are two vectors in polar coordinates and their interior product.
In[3]:=
vector1=r+θ;vector2=a+b;vector2⊖vector1%//
//Simplify//Timing
e
r
e
θ
e
r
e
θ
ToMetricElements |
Out[3]=
(a+b)⊖(r+θ)
e
r
e
θ
e
r
e
θ
Out[3]=
{0.0780005,r(a+brθ)}
The following evaluates by conversion to a contractor.
In[4]:=
vector2⊖vector1//
//Timing
ContractInteriorProducts |
Out[4]=
{0.0156001,r(a+brθ)}
In[1]:=
SetEuclideanNSpace[4,{w,x,y,z},"Vector"]
The following illustrates how significant improvements in efficiency can be obtained by using instead of .
ContractInteriorProducts
ToMetric
In[2]:=
vector1=5+2+8;vector2=(-4++4-6)⋀(6+2+14-4)⋀(-26-7-52+8)⋀(4+2+4);step1=vector2⊖vector1//
//Expand//Timingstep2=vector2⊖vector1//
//TimingFirst[step2]/First[step1]
e
x
e
y
e
z
e
w
e
x
e
y
e
z
e
w
e
x
e
y
e
z
e
w
e
x
e
y
e
z
e
w
e
y
e
z
ContractInteriorProducts |
ToMetricElements |
Out[2]=
{0.0624004,-64⋀⋀+16⋀⋀-40⋀⋀}
e
w
e
x
e
y
e
w
e
x
e
z
e
w
e
y
e
z
Out[2]=
{13.4005,-64⋀⋀+16⋀⋀-40⋀⋀}
e
w
e
x
e
y
e
w
e
x
e
z
e
w
e
y
e
z
Out[2]=
214.75
Improvement can be obtained by using before applying
ExpandAndSimplifyExteriorProducts
ToMetricElements.
In[3]:=
step3=vector2⊖vector1//
//
//TimingFirst[step3]/First[step1]
ExpandAndSimplifyExteriorProducts |
ToMetricElements |
Out[3]=
{0.904806,-64⋀⋀+16⋀⋀-40⋀⋀}
e
w
e
x
e
y
e
w
e
x
e
z
e
w
e
y
e
z
Out[3]=
14.5
Further improvement is obtained by using before .
GrassmannBreakout
ToMetricElements
In[4]:=
step4=vector2⊖vector1//
[All,All]//
//TimingFirst[step4]/First[step1]
GrassmannBreakout |
ToMetricElements |
Out[4]=
{0.592804,-64⋀⋀+16⋀⋀-40⋀⋀}
e
w
e
x
e
y
e
w
e
x
e
z
e
w
e
y
e
z
Out[4]=
9.5
ContractInteriorProducts
|
|
""

