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


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

Re: list manipulation

From Bob Hanlon <hanlonr@cox.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: list manipulation
Date 2011-02-11 09:14 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ij2ulh$7jo$1@smc.vnet.net> (permalink)

Show all headers | View raw


list1 = Array[x, 4]

{x[1], x[2], x[3], x[4]}

list2 = Array[y, 4]

{y[1], y[2], y[3], y[4]}

Either

list3 = Transpose[{list1, list2}]

{{x[1], y[1]}, {x[2], y[2]}, {x[3], y[3]}, {x[4], y[4]}}

or

list3 = Thread[{list1, list2}]

{{x[1], y[1]}, {x[2], y[2]}, {x[3], y[3]}, {x[4], y[4]}}

% == %%

True


Bob Hanlon

---- Andrea <andrea.dellapatria@gmail.com> 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!

Tanks in advance for your support

Andrea


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


Thread

Re: list manipulation Bob Hanlon <hanlonr@cox.net> - 2011-02-11 09:14 +0000

csiph-web