Re: Transpose[{1,2}]
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1239] Re: Transpose[{1,2}]
- From: ianc (Ian Collier)
- Date: Fri, 26 May 1995 05:20:03 -0400
- Organization: Wolfram Research, Inc
In article <3puhtc$m8n at news0.cybernetics.net>, Xah Y Lee <xyl10060 at fhda.edu> wrote: > this is a discrepency between versions. In student version 2.1, if one do > > Transpose[{1,2}], > > mma returns {1,2} without generating any errors. But in > version 2.2, an error > message something like "Transpose::nmxd" will come up complaining about the > argument being one dimensional. I wasn't aware of this until my program > went out that contain the above line. Caused me much distress <g>. > This is maybe clearer if we look at the useage message for Transpose. In[95]:= ?Transpose Transpose[list] transposes the first two levels in list. Transpose[list, {n1, n2, ...}] transposes list so that the nk-th level in list is the k-th level in the result. As the usage message implies, Transpose is expecting the list it is given to have at least two levels. In[96]:= Transpose[{1,2,3}] Transpose::nmtx: The first two levels of the one dimensional list {1, 2, 3} cannot be transposed. Out[96]= Transpose[{1, 2, 3}] Nesting the list one level deeper allows it to do what I suspect you expected. In[97]:= Transpose[{{1,2,3}}] Out[97]= {{1}, {2}, {3}} Incidentally, if you have found what you suspect may be a bug in Mathematica you can send reports directly to Wolfram Research Technical Support at support at wri.com. While I and other people at Wolfram research do read and respond to posts here, sending things directly to Technical Support ensures that your report will be passed on to our developers if it is a bug. I hope this helps, --Ian ---------------------------------------------------------------- Ian Collier Technical Sales Support Wolfram Research, Inc. ---------------------------------------------------------------- Tel (217) 398-0700 Fax (217) 398-0747 ianc at wri.com Wolfram Research Home Page http://www.wri.com/ ----------------------------------------------------------------