1
$\begingroup$

The problem I have is the following:

Let C be a list of coordinates, say, C = {x1, x2, ..., xn} and T be a tensor (possibly with symmetries) defined using the Array command (e.g., for a tensor with $3$ covariant components):

T = Array[ tt, { dim, dim, dim}]

where dim = n.
Now what I want is to declare that each and every component is a function of the coordinates.

Unfortunately, a command like:

T = Array[ tt[ x1, x2, ..., xn], { dim, dim, dim}]

does not work.

Any suggestions?

$\endgroup$
1
  • $\begingroup$ Look up Function or Slot. Define tt as tt[x1[#1,#2,#3], x2[...], ...]& $\endgroup$ Commented Nov 3, 2013 at 23:25

1 Answer 1

1
$\begingroup$

Improving a bit on @Sjoerd C. de Vries comment, you use SlotSequence (##) to do the following:

c = {x1, x2};

T = Array[t[##] @@ c &, {2, 2}]
{
 {t[1, 1][x1, x2], t[1, 2][x1, x2]}, 
 {t[2, 1][x1, x2], t[2, 2][x1, x2]}
}

Taking partial derivatives w.r.t. to one of the coordinates (just to name an example) then works as expected:

D[T, x1]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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