Re: Covariant derivatives of tensors?
- To: mathgroup at smc.vnet.net
- Subject: [mg107340] Re: Covariant derivatives of tensors?
- From: dh <dh at metrohm.com>
- Date: Tue, 9 Feb 2010 07:59:44 -0500 (EST)
- References: <hkeard$t22$1@smc.vnet.net>
Hi Erik,
to accomodate an unknown number of indices, you may dynamically build
the iteration specification. Here is an example:
multiindex[exp_, vars_, dim_] :=
Table[exp, Evaluate[Sequence @@ {#, 1, dim} & /@ vars]]
if you e.g. say: multiindex[a[i1, i2], {i1, i2}, 2]
you get: {{a[1, 1], a[1, 2]}, {a[2, 1], a[2, 2]}}
Daniel
Erik Max Francis wrote:
> Working on my tensor library, I'm trying to implement the covariant
> derivative for an arbitrary-rank tensor. I'm keeping track of which
> indices are contravariant/upper and covariant/lower, so the problem
> isn't managing what each term would be, but rather I'm having difficulty
> seeing how to take an arbitrary tensor and "add" a new index to it.
> This in effect requires running Table with an arbitrary number of
> indices, and then adding one. Given the arbitrariness of the
> multidimensional array, I'm not seeing how to do it. The naive approach
> would be something like:
>
> Table[
> <complex function involving many terms of a[[i1]][[i2]]...>
> {j, n}, {i1, n}, {i2, n}, ... {ir, n}]
>
> where the variable si1 .. ir (r of them) range over the value 1 through
> n for each of the indices of the tensor (of rank r), j is the additional
> index added by the covariant derivative, and n is the dimensionality of
> the space.
>
> I'm not seeing how to do this dynamically, since I don't know in advance
> what the rank of the tensor is, and I'm still relatively new to
> Mathematica. Any ideas?
>