Re: Covariant derivatives of tensors?
- To: mathgroup at smc.vnet.net
- Subject: [mg107460] Re: Covariant derivatives of tensors?
- From: Erik Max Francis <max at alcyone.com>
- Date: Sat, 13 Feb 2010 05:23:08 -0500 (EST)
- References: <hkeard$t22$1@smc.vnet.net> <hkrm9u$m3f$1@smc.vnet.net>
dh wrote: > 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]}} Thanks for your help. I did in fact come up with a solution which involved iterating over each permutation of the list of indices (creating them via Tuples), then performing the (involved) computation for each permutation (along with the new covariant index), building a list of rules, and then constructing an empty (higher-dimensional) array with Nest and Outer, and finally applying the replacements with ReplacePart. This is probably not ideal in terms of efficiency, but it works. Since the main excuse here was to 1. get more experience with Mathematica just for the fun of it, 2. help solidify my knowledge of tensor calculus, and 3. write a package for the first time, I'll put together some "examples" using the package and then post it somewhere for feedback. -- Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/ San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis Love is a hole in the heart. -- Ben Hecht