Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: list manipulation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116323] Re: list manipulation
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 11 Feb 2011 04:13:55 -0500 (EST)

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 at 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




  • Prev by Date: Re: print issues
  • Next by Date: Re: k-permutations enumeration
  • Previous by thread: Re: list manipulation
  • Next by thread: Re: list manipulation