2
$\begingroup$

Are there some good tutorials (.nb files) about Tensor analysis using index notation built in to Mathematica?

An example of a typical index notation:

$$C_{i j k l} = \lambda \delta_{i j} \delta_{k l} + \alpha \delta_{i k} \delta_{j l} + \beta \delta_{i l} \delta_{j k}$$

$\endgroup$
5
$\begingroup$

In Mathematica, symbolic tensors don't necessarily use indices. Instead, tensors are declared to have a certain number of indices (rank):

$Assumptions = A ∈ Arrays[{d, d}];

The above code asserts that A is a tensor of rank 2 where each index is of dimension d. For your example, let:

id4 = TensorProduct[IdentityMatrix[d], IdentityMatrix[d]];

The tensor id4 corresponds to your $\lambda \delta_{i j} \delta_{k l}$ term. Your other tensors are just transposed versions:

$\alpha \delta_{i k} \delta_{j l}$:

TensorTranspose[id4, {1,3,2,4}]

$\beta \delta_{i l} \delta_{j k}$:

TensorTranspose[id4, {1, 4, 2, 3}]

So, Mathematica would represent your tensor equation as:

c = λ id4 + α TensorTranspose[id4, {1,3,2,4}] + β TensorTranspose[id4, {1,4,2,3}];

If you use an explicit dimension, then the above code would be represented using indices of an array. As an example, let the dimensions be $d=3$, and check that the above equation sets the indices of c to the correct values:

d = 3;
c[[1, 2, 1, 2]]
c[[1, 1, 2, 2]]
c[[1, 2, 2, 1]]

α

λ

β

$\endgroup$
  • $\begingroup$ thanking you! but in this case I only want to use index notation in mathematica, it should be helpful in some cases. Thanks you for your understanding! $\endgroup$ – ABCDEMMM Jul 2 '18 at 13:43
  • $\begingroup$ Dear all. I only want to use build-in, not third part. If I search such topics in google, most are third part tool in mathematica. $\endgroup$ – ABCDEMMM Jul 2 '18 at 13:44
  • $\begingroup$ @FEAPMAN TensorProduct and TensorTranspose are the built-in symbols that one can use with tensors. They are not from a third party package. $\endgroup$ – Carl Woll Jul 2 '18 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.