TensorInnerProduct - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

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

 • Let P = TensorInnerProduct(g, T, S). Let  and  be the inverse metric. If and  are vectors, then . If and are 1-forms, then . Ifand  are 2-forms, then . If  and , then 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.

Examples

 > $\mathrm{with}\left(\mathrm{DifferentialGeometry}\right):$$\mathrm{with}\left(\mathrm{Tensor}\right):$

First define a manifold M with local coordinates $\left(x,y,z\right)$ and define a (covariant) metric on $M.$

 > $\mathrm{DGsetup}\left(\left[x,y,z\right],M\right):$
 M > $gâ‰”\mathrm{evalDG}\left(x\mathrm{dx}&t\mathrm{dx}+y\mathrm{dy}&t\mathrm{dy}+z\mathrm{dz}&t\mathrm{dz}\right)$
 ${g}{:=}{\mathrm{_DG}}{}\left(\left[\left[{"tensor"}{,}{M}{,}\left[\left[{"cov_bas"}{,}{"cov_bas"}\right]{,}\left[\right]\right]\right]{,}\left[\left[\left[{1}{,}{1}\right]{,}{x}\right]{,}\left[\left[{2}{,}{2}\right]{,}{y}\right]{,}\left[\left[{3}{,}{3}\right]{,}{z}\right]\right]\right]\right){,}{\mathrm{_DG}}{}\left(\left[\left[{"tensor"}{,}{M}{,}\left[\left[{"cov_bas"}{,}{"cov_bas"}\right]{,}\left[\right]\right]\right]{,}\left[\left[\left[{1}{,}{1}\right]{,}{x}\right]{,}\left[\left[{2}{,}{2}\right]{,}{y}\right]{,}\left[\left[{3}{,}{3}\right]{,}{z}\right]\right]\right]\right)$ (2.1)

Example 1.

Compute the inner product of two vectors.

 M > $Xâ‰”\mathrm{evalDG}\left(\mathrm{a1}\mathrm{D_x}+\mathrm{a2}\mathrm{D_y}+\mathrm{a3}\mathrm{D_z}\right)$
 ${X}{:=}{\mathrm{_DG}}{}\left(\left[\left[{"vector"}{,}{M}{,}\left[\right]\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{a1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{a2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{a3}}\right]\right]\right]\right){,}{\mathrm{_DG}}{}\left(\left[\left[{"vector"}{,}{M}{,}\left[\right]\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{a1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{a2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{a3}}\right]\right]\right]\right)$ (2.2)
 M > $Yâ‰”\mathrm{evalDG}\left(\mathrm{b1}\mathrm{D_x}+\mathrm{b2}\mathrm{D_y}+\mathrm{b3}\mathrm{D_z}\right)$
 ${Y}{:=}{\mathrm{_DG}}{}\left(\left[\left[{"vector"}{,}{M}{,}\left[\right]\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{b1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{b2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{b3}}\right]\right]\right]\right){,}{\mathrm{_DG}}{}\left(\left[\left[{"vector"}{,}{M}{,}\left[\right]\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{b1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{b2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{b3}}\right]\right]\right]\right)$ (2.3)
 M > $\mathrm{TensorInnerProduct}\left(g,X,Y\right)$
 ${\mathrm{a1}}{}{\mathrm{b1}}{}{x}{+}{\mathrm{a2}}{}{\mathrm{b2}}{}{y}{+}{\mathrm{a3}}{}{\mathrm{b3}}{}{z}$ (2.4)

Example 2.

Compute the inner product of two 1-forms.

 M > $\mathrm{α}â‰”\mathrm{evalDG}\left(\mathrm{a1}\mathrm{dx}+\mathrm{a2}\mathrm{dy}+\mathrm{a3}\mathrm{dz}\right)$
 ${\mathrm{α}}{:=}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{1}\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{a1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{a2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{a3}}\right]\right]\right]\right){,}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{1}\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{a1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{a2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{a3}}\right]\right]\right]\right)$ (2.5)
 M > $\mathrm{β}â‰”\mathrm{evalDG}\left(\mathrm{b1}\mathrm{dx}+\mathrm{b2}\mathrm{dy}+\mathrm{b3}\mathrm{dz}\right)$
 ${\mathrm{β}}{:=}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{1}\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{b1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{b2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{b3}}\right]\right]\right]\right){,}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{1}\right]{,}\left[\left[\left[{1}\right]{,}{\mathrm{b1}}\right]{,}\left[\left[{2}\right]{,}{\mathrm{b2}}\right]{,}\left[\left[{3}\right]{,}{\mathrm{b3}}\right]\right]\right]\right)$ (2.6)
 M > $\mathrm{expand}\left(\mathrm{TensorInnerProduct}\left(g,\mathrm{α},\mathrm{β}\right)\right)$
 $\frac{{\mathrm{a3}}{}{\mathrm{b3}}}{{z}}{+}\frac{{\mathrm{a2}}{}{\mathrm{b2}}}{{y}}{+}\frac{{\mathrm{a1}}{}{\mathrm{b1}}}{{x}}$ (2.7)

Example 3.

Compute the inner product of two 2-forms.

 M > $\mathrm{α}â‰”\mathrm{evalDG}\left(\mathrm{a1}\mathrm{dx}&w\mathrm{dy}+\mathrm{a2}\mathrm{dx}&w\mathrm{dz}+\mathrm{a3}\mathrm{dy}&w\mathrm{dz}\right)$
 ${\mathrm{α}}{:=}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{2}\right]{,}\left[\left[\left[{1}{,}{2}\right]{,}{\mathrm{a1}}\right]{,}\left[\left[{1}{,}{3}\right]{,}{\mathrm{a2}}\right]{,}\left[\left[{2}{,}{3}\right]{,}{\mathrm{a3}}\right]\right]\right]\right){,}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{2}\right]{,}\left[\left[\left[{1}{,}{2}\right]{,}{\mathrm{a1}}\right]{,}\left[\left[{1}{,}{3}\right]{,}{\mathrm{a2}}\right]{,}\left[\left[{2}{,}{3}\right]{,}{\mathrm{a3}}\right]\right]\right]\right)$ (2.8)
 M > $\mathrm{β}â‰”\mathrm{evalDG}\left(\mathrm{b1}\mathrm{dx}&w\mathrm{dy}+\mathrm{b2}\mathrm{dx}&w\mathrm{dz}+\mathrm{b3}\mathrm{dy}&w\mathrm{dz}\right)$
 ${\mathrm{β}}{:=}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{2}\right]{,}\left[\left[\left[{1}{,}{2}\right]{,}{\mathrm{b1}}\right]{,}\left[\left[{1}{,}{3}\right]{,}{\mathrm{b2}}\right]{,}\left[\left[{2}{,}{3}\right]{,}{\mathrm{b3}}\right]\right]\right]\right){,}{\mathrm{_DG}}{}\left(\left[\left[{"form"}{,}{M}{,}{2}\right]{,}\left[\left[\left[{1}{,}{2}\right]{,}{\mathrm{b1}}\right]{,}\left[\left[{1}{,}{3}\right]{,}{\mathrm{b2}}\right]{,}\left[\left[{2}{,}{3}\right]{,}{\mathrm{b3}}\right]\right]\right]\right)$ (2.9)
 M > $\mathrm{expand}\left(\mathrm{TensorInnerProduct}\left(g,\mathrm{α},\mathrm{β}\right)\right)$
 $\frac{{2}{}{\mathrm{a3}}{}{\mathrm{b3}}}{{z}{}{y}}{+}\frac{{2}{}{\mathrm{a2}}{}{\mathrm{b2}}}{{z}{}{x}}{+}\frac{{2}{}{\mathrm{a1}}{}{\mathrm{b1}}}{{y}{}{x}}$ (2.10)

Example 4.

Compute the inner product of two rank-3 tensors.

 M > $Tâ‰”\mathrm{evalDG}\left(2\left(\mathrm{dx}&t\mathrm{D_y}\right)&t\mathrm{dz}+3\left(\mathrm{dx}&t\mathrm{D_z}\right)&t\mathrm{dy}+8\left(\mathrm{dy}&t\mathrm{D_z}\right)&t\mathrm{dx}\right)$
 ${T}{:=}{2}{}{\mathrm{dx}}{}{\mathrm{D_y}}{}{\mathrm{dz}}{+}{3}{}{\mathrm{dx}}{}{\mathrm{D_z}}{}{\mathrm{dy}}{+}{8}{}{\mathrm{dy}}{}{\mathrm{D_z}}{}{\mathrm{dx}}$ (2.11)
 M > $Sâ‰”\mathrm{evalDG}\left(5\left(\mathrm{dx}&t\mathrm{D_y}\right)&t\mathrm{dz}+7\left(\mathrm{dx}&t\mathrm{D_z}\right)&t\mathrm{dz}+3\left(\mathrm{dx}&t\mathrm{D_z}\right)&t\mathrm{dx}\right)$
 ${S}{:=}{5}{}{\mathrm{dx}}{}{\mathrm{D_y}}{}{\mathrm{dz}}{+}{3}{}{\mathrm{dx}}{}{\mathrm{D_z}}{}{\mathrm{dx}}{+}{7}{}{\mathrm{dx}}{}{\mathrm{D_z}}{}{\mathrm{dz}}$ (2.12)
 M > $\mathrm{TensorInnerProduct}\left(g,T,S\right)$
 $\frac{{10}{}{y}}{{z}{}{x}}$ (2.13)

Partial contractions of T and S can be computed.

 M > $\mathrm{TensorInnerProduct}\left(g,T,S,\mathrm{tensorindices}=\left[1,3\right]\right)$
 $\frac{{10}{}{\mathrm{D_y}}{}{\mathrm{D_y}}}{{z}{}{x}}{+}\frac{{14}{}{\mathrm{D_y}}{}{\mathrm{D_z}}}{{z}{}{x}}$ (2.14)
 M > $\mathrm{TensorInnerProduct}\left(g,T,S,\mathrm{tensorindices}=\left[2,3\right]\right)$
 $\frac{{10}{}{y}{}{\mathrm{dx}}{}{\mathrm{dx}}}{{z}}{+}\frac{{24}{}{z}{}{\mathrm{dy}}{}{\mathrm{dx}}}{{x}}$ (2.15)

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.

 M > $gâ‰”\mathrm{evalDG}\left(a\mathrm{dx}&t\mathrm{dx}+b\mathrm{dy}&t\mathrm{dy}+c\mathrm{dy}&t\mathrm{dz}+c\mathrm{dz}&t\mathrm{dy}\right)$
 ${g}{:=}{a}{}{\mathrm{dx}}{}{\mathrm{dx}}{+}{b}{}{\mathrm{dy}}{}{\mathrm{dy}}{+}{c}{}{\mathrm{dy}}{}{\mathrm{dz}}{+}{c}{}{\mathrm{dz}}{}{\mathrm{dy}}$ (2.16)
 M > $hâ‰”\mathrm{InverseMetric}\left(g\right)$
 ${h}{:=}\frac{{\mathrm{D_x}}{}{\mathrm{D_x}}}{{a}}{+}\frac{{\mathrm{D_y}}{}{\mathrm{D_z}}}{{c}}{+}\frac{{\mathrm{D_z}}{}{\mathrm{D_y}}}{{c}}{-}\frac{{b}{}{\mathrm{D_z}}{}{\mathrm{D_z}}}{{{c}}^{{2}}}$ (2.17)
 M > $\mathrm{Ω}â‰”\left[\mathrm{dx},\mathrm{dy},\mathrm{dz}\right]$
 ${\mathrm{Ω}}{:=}\left[{\mathrm{dx}}{,}{\mathrm{dy}}{,}{\mathrm{dz}}\right]$ (2.18)
 M > $\mathrm{TensorInnerProduct}\left(g,\mathrm{Ω},\mathrm{Ω},\mathrm{inversemetric}=h\right)$