Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15974

Re: list manipulation

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: list manipulation
Date 2011-02-11 09:19 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ij2uug$7t5$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 2/10/11 at 5:19 AM, andrea.dellapatria@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}}

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: list manipulation Bill Rowe <readnews@sbcglobal.net> - 2011-02-11 09:19 +0000

csiph-web