RE: Condensing a 4-Tensor into a 2-Tensor
- To: mathgroup at smc.vnet.net
- Subject: [mg45140] RE: [mg45116] Condensing a 4-Tensor into a 2-Tensor
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Thu, 18 Dec 2003 06:55:15 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: Ashok. R [mailto:ashokr at alum.dartmouth.org] To: mathgroup at smc.vnet.net >Sent: Wednesday, December 17, 2003 1:55 PM >To: mathgroup at smc.vnet.net >Subject: [mg45140] [mg45116] Condensing a 4-Tensor into a 2-Tensor > > >Greetings. > >I have a 4-Tensor H, whose components are given by H[i,j,k,l]. >The tensor >has minor symmetries so that H[i,j,k,l] = H[j,i,k,l] = >H[i,j,l,k]. So there >are only 36 distinct components in this tensor. I want to >condense these >into a 6x6 2-tensor (Matrix), D, with the following rules: > >D(1,1) should map to H[1,1,1,1] >D(1,2) should map to H[1,1,2,2] >D(1,3) should map to H[1,1,3,3] >D(1,4) should map to H[1,1,1,2] >D(1,5) should map to H[1,1,1,3] >D(1,6) should map to H[1,1,2,3] and so on. > >Basically for D(i,j) : >If i<=3, replace i with i,i in H >If i = 4, replace i with 1,2 in H >If i = 5, replace i with 1,3 in H >if i = 6, replace i with 2,3 in H > >The rules are the same for j: >If j<=3, replace j with j,j H >If j = 4, replace j with 1,2 in H >If j = 5, replace j with 1,3 in H >if j = 6, replace j with 2,3 in H > >The only way I can think of is the tedious way of assigning >all 3,6 entries >individually. Is there a shorter, more elegant way to do this ? > >Thanks, > >Ashok > > We first go for the simpler problem 3 x 3 <--> 6 Transformation from 6-vector to 3 x 3 matrix: In[1]:= from6to33[{a1_, a2_, a3_, a4_, a5_, a6_}] := {{a1, a4, a5}, {a4, a2, a6}, {a5, a6, a3}} In[2]:= smallD = Array[d, {6}] Out[2]= {d[1], d[2], d[3], d[4], d[5], d[6]} In[3]:= smallH = from6to33[smallD] Out[3]= {{d[1], d[4], d[5]}, {d[4], d[2], d[6]}, {d[5], d[6], d[3]}} Inverse Transformation: In[4]:= from33to6[{{a1_, a4_, a5_}, {a4_, a2_, a6_}, {a5_, a6_, a3_}}] := {a1, a2, a3, a4, a5, a6} In[5]:= from33to6[smallH] Out[5]= {d[1], d[2], d[3], d[4], d[5], d[6]} Now for the more complicated case: In[6]:= bigD = Array[dd, {6, 6}]; In[7]:= bigH = from6to33[from6to33 /@ bigD]; In[8]:= Table[bigH[[i, j, k, l]] == bigH[[j, i, k, l]] == bigH[[i, j, l, k]], {i, 3}, {j, 3}, {k, 3}, {l, 3}] Out[8]= {{{{True, True, True}, {True, True, True}, {True, True, True}}, {{True, True, True}, {True, True, True}, {True, True, True}}, {{True, True, True}, {True, True, True}, {True, True, True}}}, {{{True, True, True}, {True, True, True}, {True, True, True}}, {{True, True, True}, {True, True, True}, {True, True, True}}, {{True, True, True}, {True, True, True}, {True, True, True}}}, {{{True, True, True}, {True, True, True}, {True, True, True}}, {{True, True, True}, {True, True, True}, {True, True, True}}, {{True, True, True}, {True, True, True}, {True, True, True}}}} In[9]:= from33to6 /@ from33to6[bigH] Out[9]= {{dd[1, 1], dd[1, 2], dd[1, 3], dd[1, 4], dd[1, 5], dd[1, 6]}, {dd[2, 1], dd[2, 2], dd[2, 3], dd[2, 4], dd[2, 5], dd[2, 6]}, {dd[3, 1], dd[3, 2], dd[3, 3], dd[3, 4], dd[3, 5], dd[3, 6]}, {dd[4, 1], dd[4, 2], dd[4, 3], dd[4, 4], dd[4, 5], dd[4, 6]}, {dd[5, 1], dd[5, 2], dd[5, 3], dd[5, 4], dd[5, 5], dd[5, 6]}, {dd[6, 1], dd[6, 2], dd[6, 3], dd[6, 4], dd[6, 5], dd[6, 6]}} alternatively you might go to bigH from bigD: In[11]:= Map[from6to33, from6to33[bigD], {2}]; In[12]:= % == bigH Out[12]= True and back, alternatively: In[15]:= from33to6[Map[from33to6, bigH, {2}]]; In[16]:= % == bigD Out[16]= True Another way to look at these pair of transformations would be: In[25]:= Map[from6to33, Map[from6to33, bigD, {1}], {0}]; In[27]:= Map[from6to33, Map[from6to33, bigD, {0}], {2}]; and In[20]:= Map[from33to6, Map[from33to6, bigH, {2}], {0}] In[22]:= Map[from33to6, Map[from33to6, bigH, {0}], {1}] Well, I'm gonna playing. Define In[29]:= FoldMap[f_, obj_, list_] := Fold[Map[f, #1, {#2}] &, obj, list] And use a single name In[38]:= trans[v : {a1_, a2_, a3_, a4_, a5_, a6_}] := from6to33[v] In[39]:= trans[m : {{a1_, a4_, a5_}, {a4_, a2_, a6_}, {a5_, a6_, a3_}}] := from33to6[m] Such In[40]:= FoldMap[trans, bigD, {0, 2}] == bigH Out[40]= True In[41]:= FoldMap[trans, bigH, {2, 0}] == bigD Out[41]= True In[42]:= FoldMap[trans, bigD, {1, 0}] == bigH Out[42]= True In[43]:= FoldMap[trans, bigH, {0, 1}] == bigD Out[43]= True of course you now could introduce names forth = {1, 0} (or was it {0, 2} ?) and back = Reverse[forth]... Possibly your 6-vector representation of the symmetric 3-tensors is not suited best. Perhaps you might like to look for a scalar (x) spin-2 representation. -- Hartmut Wolf