Re: list manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg116350] Re: list manipulation
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Fri, 11 Feb 2011 04:18:48 -0500 (EST)
On 2/10/11 at 5:19 AM, andrea.dellapatria at gmail.com (Andrea) wrote: >hello, I need help about the following question: >I have two N-dimensional lists: >list1={x1,x2,...,xN} list2={y1,y2,...,yN} >How to create the N-dimrnsional list: list3={{x1,y1},{x2,y2},..., >{xN,yN}} ? >I've tried so hard but I didn't work it out! There are a variety of ways to accomplish what you want. Here are two: In[6]:= list1 = RandomInteger[100, {5}]; list2 = RandomInteger[10, {5}]; In[8]:= Transpose@{list1, list2} Out[8]= {{71, 2}, {17, 4}, {47, 8}, {9, 2}, {99, 5}} In[9]:= MapThread[List, {list1, list2}] Out[9]= {{71, 2}, {17, 4}, {47, 8}, {9, 2}, {99, 5}}