({{, (RefLink[TensorExpand, paclet:ref/TensorExpand])[texpr] 
expands out tensor-related products in the symbolic tensor expression texpr.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[TensorExpand, paclet:ref/TensorExpand]) expands sums and products by scalars in tensorial arguments.

Expressions involving (RefLink[Dot, paclet:ref/Dot]) and (RefLink[Cross, paclet:ref/Cross]) are expanded by converting products of pairs of (RefLink[Cross, paclet:ref/Cross]) subexpressions into linear combinations of (RefLink[Dot, paclet:ref/Dot]) products.

Symbolic arguments of (RefLink[Cross, paclet:ref/Cross]) are assumed to represent vectors of adequate dimensionality.

Symbolic arguments of (RefLink[MatrixPower, paclet:ref/MatrixPower]) and (RefLink[Inverse, paclet:ref/Inverse]) are assumed to represent invertible square matrices.

OpenersPrimaryExamplesSection(Spacer1)Examples  (15)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Tensor products of linear combinations are not expanded automatically:

(v1+v2)⊗(w1-2w2)

Expand the product:

%//TensorExpand

Expand a scalar product of two cross products:

(a\[Cross]b).(c\[Cross]d)//TensorExpand

OpenersExampleSection1(Spacer1)Scope  (3)

Act on expressions containing all kinds of products:

(2a+b)c//TensorExpand

(2a+b)⊗c//TensorExpand

(2a+b).c//TensorExpand

(2a+b)\[TensorWedge]c//TensorExpand

(2a+b)\[Cross]c//TensorExpand

Act on expressions containing both symbolic and explicit objects:

(2a+b)⊗{x,y,z}//TensorExpand

For some operations, additional information needs to be supplied. The (RefLink[Dot, paclet:ref/Dot]) product is not commutative in general:

a.b-b.a//TensorExpand

However, if the objects are declared as vectors, then it is commutative:

Assuming[(a|b)∈Vectors[dim],%//TensorExpand]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)Assumptions  (1)

This expression cannot be canonicalized because the rank of a is unknown:

TensorExpand[(b\[Cross]c).a]

Assume that a is a vector:

TensorExpand[(b\[Cross]c).a,Assumptions->a∈Vectors[3]]

OpenersExampleSection3(Spacer1)Applications  (6)

Linearity expansions:

(2v-w).w//TensorExpand

(7v-3w)\[Cross](w+v)//TensorExpand

Vector identities in dimension 3:

(v\[Cross]w).v//TensorExpand

w\[Cross]v//TensorExpand

a\[Cross](b\[Cross]c)//TensorExpand

(a\[Cross]b)\[Cross]c==-c\[Cross](a\[Cross]b)==-a(b.c)+b(a.c)//TensorExpand

(a\[Cross]b).(c\[Cross]d)//TensorExpand

(a\[Cross]b).(c\[Cross]d)==(a\[Cross]c).(b\[Cross]d)-(b\[Cross]c).(a\[Cross]d)//TensorExpand

a\[Cross](b\[Cross](c\[Cross]d))==b a.(c\[Cross]d)-(a.b)c\[Cross]d//TensorExpand

a (b\[Cross]c).d-b(a\[Cross]c).d+c(a\[Cross]b).d-d(a\[Cross]b).c==0//TensorExpand

((a\[Cross]b).c)^4//TensorExpand

Vector identities in dimension 4:

a\[Cross]b\[Cross]c==b\[Cross]c\[Cross]a//TensorExpand

(a\[Cross]b\[Cross]c).(d\[Cross]e\[Cross]f)//TensorExpand

(a\[Cross]b\[Cross]c)\[Cross](a\[Cross]b\[Cross]d)\[Cross](a\[Cross]b\[Cross]e)==0//TensorExpand

Combination of transpositions:

Transpose[Transpose[A,{2,3,1}],{2,1,3}]//TensorExpand

ConjugateTranspose[Transpose[A,{2,3,1}]]//TensorExpand

Powers of matrices. Matrices are assumed invertible:

MatrixPower[M,4].M.M.Inverse[M]//TensorExpand

MatrixPower[Transpose[Inverse[Transpose[M]]],4]//TensorExpand

Declare a, b, c to be three-dimensional vectors:

$Assumptions=(a|b|c)∈Vectors[3]

Then these formulas effectively invert the matrix {a,b,c}:

ap=((b\[Cross]c)/(a.b\[Cross]c));
bp=((c\[Cross]a)/(a.b\[Cross]c));
cp=((a\[Cross]b)/(a.b\[Cross]c));

Outer[Dot,{a,b,c},{ap,bp,cp}]//TensorExpand

OpenersExampleSection4(Spacer1)Possible Issues  (2)

Expansion of pairs of vector products requires consistent dimensions:

(a\[Cross]b\[Cross]c)\[Cross](d\[Cross]e\[Cross]f)//TensorExpand

With symbolic expressions, the result may be given as 0, representing a 0 vector or tensor:

a\[Cross]a//TensorExpand

Compare with:

{x,y,z}\[Cross]{x,y,z}

OpenersExampleSection5(Spacer1)Neat Examples  (1)

Declare a family of vectors:

TensorRank[(Subscript[v, n_])]^=1;

For each integer n, there is a tree expression involving n (RefLink[Cross, paclet:ref/Cross]) operations for n+1 vectors (Subscript[v, 0]),…,(Subscript[v, n]):

TreeCross[0]:=(Subscript[v, 0]);
TreeCross[n_]:=TreeCross[n-1]/.With[{m=BitClear[n,Floor@Log[2,n]]},(Subscript[v, m])->Cross[(Subscript[v, m]),(Subscript[v, n])]]

TreeCross[7]

TreeForm[%,3]

Now systematically convert all possible combinations of cross products into dot products and one cross product:

Do[Print[TreeCross[n]==TensorExpand[TreeCross[n]]],{n,0,8}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Dot, paclet:ref/Dot])  ▪  (RefLink[Cross, paclet:ref/Cross])  ▪  (RefLink[TensorProduct, paclet:ref/TensorProduct])  ▪  (RefLink[TensorWedge, paclet:ref/TensorWedge])  ▪  (RefLink[TensorReduce, paclet:ref/TensorReduce])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Symbolic Tensors, paclet:tutorial/SymbolicTensors])}, {▪(RefLinkPlain[Tensor Symmetries, paclet:tutorial/TensorSymmetries])}, {▪(RefLinkPlain[Symmetrized Arrays, paclet:tutorial/SymmetrizedArrays])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Symbolic Tensors, paclet:guide/SymbolicTensors])}})}})