Tensor[TensorInnerProduct] - compute the inner product of two vectors, forms or tensors with respect to a given metric tensor
Calling Sequences
TensorInnerProduct(g, T, S, keywords)
Parameters
g - a covariant metric tensor on a manifold M
T, S - two vector fields, forms or tensors (with the same index type) on M, or lists of such
keywords - (optional) inversemetric = h, where h is the inverse metric to g; tensorindices = indx, where indx is a list of positive integers.
Description
Examples
Let P = TensorInnerProduct(g, T, S). Let g = gij dxi dxj and h = hij ∂i∂j be the inverse metric. If T = ti ∂i and S = sj ∂j are vectors, then P= gij ti sj. If T = ti dxi and S = sj dxj are 1-forms, then P= hij ti sj. If T = tijdxi ∧dxj and S = sijdxi ∧dxj are 2-forms, then P= hikhjltijskl. If T= tjki∂i dxjdxk and S = sjki∂idxjdxk, then P = giahjbhkct ijksbca and so on.
When repeated calls are to be made to TensorInnerProduct, the keyword argument inversemetric be be used to avoid repeated computations of the metric inverse.
With the keyword argument tensorindices = [n1, n2, ... ], the contraction of indices used to construct the tensor inner product is restricted to the indices n1, n2, ... .
This command is part of the DifferentialGeometry:-Tensor package, and so can be used in the form TensorInnerProduct(...) only after executing the command with(DifferentialGeometry) and with(Tensor) in that order. It can always be used in the long form DifferentialGeometry:-Tensor:-TensorInnerProduct.
with⁡DifferentialGeometry:with⁡Tensor:
First define a manifold M with local coordinates x,y,z and define a (covariant) metric on M.
DGsetup⁡x,y,z,M:
g≔evalDG⁡x⁢dx&tdx+y⁢dy&tdy+z⁢dz&tdz
g:=x⁢dx⁢dx+y⁢dy⁢dy+z⁢dz⁢dz
Example 1.
Compute the inner product of two vectors.
X≔evalDG⁡a1⁢D_x+a2⁢D_y+a3⁢D_z
X:=a1⁢D_x+a2⁢D_y+a3⁢D_z
Y≔evalDG⁡b1⁢D_x+b2⁢D_y+b3⁢D_z
Y:=b1⁢D_x+b2⁢D_y+b3⁢D_z
TensorInnerProduct⁡g,X,Y
a1⁢b1⁢x+a2⁢b2⁢y+a3⁢b3⁢z
Example 2.
Compute the inner product of two 1-forms.
α≔evalDG⁡a1⁢dx+a2⁢dy+a3⁢dz
α:=a1⁢dx+a2⁢dy+a3⁢dz
β≔evalDG⁡b1⁢dx+b2⁢dy+b3⁢dz
β:=b1⁢dx+b2⁢dy+b3⁢dz
expand⁡TensorInnerProduct⁡g,α,β
a3⁢b3z+a2⁢b2y+a1⁢b1x
Example 3.
Compute the inner product of two 2-forms.
α≔evalDG⁡a1⁢dx&wdy+a2⁢dx&wdz+a3⁢dy&wdz
α:=a1⁢dx⁢⋀⁢dy+a2⁢dx⁢⋀⁢dz+a3⁢dy⁢⋀⁢dz
β≔evalDG⁡b1⁢dx&wdy+b2⁢dx&wdz+b3⁢dy&wdz
β:=b1⁢dx⁢⋀⁢dy+b2⁢dx⁢⋀⁢dz+b3⁢dy⁢⋀⁢dz
2⁢a3⁢b3z⁢y+2⁢a2⁢b2z⁢x+2⁢a1⁢b1y⁢x
Example 4.
Compute the inner product of two rank-3 tensors.
T≔evalDG⁡2⁢dx&tD_y&tdz+3⁢dx&tD_z&tdy+8⁢dy&tD_z&tdx
T:=2⁢dx⁢D_y⁢dz+3⁢dx⁢D_z⁢dy+8⁢dy⁢D_z⁢dx
S≔evalDG⁡5⁢dx&tD_y&tdz+7⁢dx&tD_z&tdz+3⁢dx&tD_z&tdx
S:=5⁢dx⁢D_y⁢dz+3⁢dx⁢D_z⁢dx+7⁢dx⁢D_z⁢dz
TensorInnerProduct⁡g,T,S
10⁢yz⁢x
Partial contractions of T and S can be computed.
TensorInnerProduct⁡g,T,S,tensorindices=1,3
10⁢D_y⁢D_yz⁢x+14⁢D_y⁢D_zz⁢x
TensorInnerProduct⁡g,T,S,tensorindices=2,3
10⁢y⁢dx⁢dxz+24⁢z⁢dy⁢dxx
Example 5.
Compute the inner product of two lists of rank-1 tensors (1-forms). In this case the efficiency of the command is improved if the keyword argument inversemetric is given.
g≔evalDG⁡a⁢dx&tdx+b⁢dy&tdy+c⁢dy&tdz+c⁢dz&tdy
g:=a⁢dx⁢dx+b⁢dy⁢dy+c⁢dy⁢dz+c⁢dz⁢dy
h≔InverseMetric⁡g
h:=D_x⁢D_xa+D_y⁢D_zc+D_z⁢D_yc−b⁢D_z⁢D_zc2
Ω≔dx,dy,dz
Ω:=dx,dy,dz
TensorInnerProduct⁡g,Ω,Ω,inversemetric=h
See Also
DifferentialGeometry
Tensor
ContractIndices
InverseMetric
RaiseLowerIndices
SpinorInnerProduct
Download Help Document