Re: Problems with high-dimensional lists

*Subject*: [mg2526] Re: Problems with high-dimensional lists*From*: withoff (David Withoff)*Date*: Thu, 16 Nov 1995 06:45:46 GMT*Approved*: usenet@wri.com*Distribution*: local*Newsgroups*: wri.mathgroup*Organization*: Wolfram Research, Inc.*Sender*: daemon at wri.com ( )

In article <489hmv$gm7 at ralph.vnet.net> Sascha at sunmail.lrz-muenchen.de, Unzicker at lrz.uni-muenchen.de writes: > Let me give an example: > > a=Table[0,{3},{4},{5},{6}]; > > Dimensions[a] > > gives you > Out[86]= {3, 4, 5, 6}, > of course. > > But if you try to assign a new value to a sublist > a[[1,1]]=Table[x,{6},{5}]; > Mathematica forgets that a still should have the Dimension {3,4,5,6}: > > In[88]:= Dimensions[a] > Out[88]= {3, 4} > In[89]:= Transpose[a,{4,1,2,3}]; > > Transpose::tperm: > Permutation {4, 1, 2, 3} is longer than the dimensions {3, 4} of the array. > > is now impossible, although > > In[90]:= a[[3,4,5,6]] > Out[90]= 0 > returns still the correct value. Why does Mathematica make this difference? > If you print a, there is no difference. > > How can you return to the desired Dimension? > > a=Array[a,{3,4,5,6}]; > > is not possible because a[[1,1,1,1]] gives a mess. > > Thanks in advance, > > Sascha Unzicker Did you perhaps mean to enter a[[1,1]]=Table[x,{5},{6}]; rather than a[[1,1]]=Table[x,{6},{5}]; ??? The latter destroys the rectangular structure of the original tensor because it replaces a sublist of dimensions {5, 6} with one of dimensions {6, 5}. I am not aware of anything unusual in this part of Mathematica, but if you could explain what you expected this to do, we could perhaps take another look at it. Dave Withoff Wolfram Research