Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Contraction of Tensors in Mathematica

  • To: mathgroup at
  • Subject: [mg112530] Re: Contraction of Tensors in Mathematica
  • From: "David Park" <djmpark at>
  • Date: Sun, 19 Sep 2010 05:36:39 -0400 (EDT)

These are the Mathematical techniques for handling tensor arrays:

1)The Prime Rule for Products of 'Tensor' Arrays in Mathematica:
	S.T dots the lowest level of S with the highest level of T,
or equivalently
	S.T dots the last level of S with the first level of T. 

2)The Mathematica Transpose[T,{n1,n2,n3,...}] moves levels {1,2,3,...} to
levels {n1,n2,n3,...}. We will always want to move the contracted level to
the first or last level when doing Dot products and to the first two levels
when doing single array contractions.

3)If R, S, T,... are Mathematica tensor arrays, then their direct product is
given by Outer[Times,R,S,T,...]. This will produce a single Mathematica
array. The levels are in the same order as the levels in the successive
When expanding tensors to be put in Outer it is best to keep the indicies in
strictly ascending sort order with the slots, or at least within each

4) The basic Mathematica command for contraction of the top two levels in a
single array T is Tr[T,Plus,2]. We will have to use Transpose on T to put
the contraction slots in the first two levels. We will have to repeat the
operation if we want to do multiple contractions.

David Park
djmpark at  

From: Sam Takoy [mailto:sam.takoy at] 


I this message I will suppress the covariant/contravariant nature of 

Suppose I have two tensors A_ijkl and B_rstu (denoted by a and b in 
Mathematica). Each tensor is presented for a 4-deep list. Now, I want to 
form a new tensor:

C_ijklrstu = A_ijkl*B_rstu

and I want C to be represented by an 8-deep list. I've gathered is that 
what I need to do is

c = Outer[Times, a, b];


Now supposed I want to do some contraction to define a new tensor

D_jklrsu = C_ijklrsiu?

How do I do that?

Many thanks in advance!


  • Prev by Date: Re: Can somebody integrate this function ?
  • Next by Date: Re: Can somebody integrate this function ?
  • Previous by thread: Re: Contraction of Tensors in Mathematica
  • Next by thread: Re: Contraction of Tensors in Mathematica