MathGroup Archive 2006

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

Search the Archive

Re: {x},{y} -> {x,y} ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68278] Re: {x},{y} -> {x,y} ?
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Mon, 31 Jul 2006 03:45:46 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 7/30/06 at 4:48 AM, anglewyrm at yahoo.com (AngleWyrm) wrote:

>Hi, I have two lists, a set of x values and a set of y values. How
>do I convert them to one list of { {x1,y1},{x2,y2} } pairs?

Any number of ways, for example

x = {x1, x2, x3, x4};
y = {y1, y2, y2, y4};

In[3]:=
Transpose@{x,y}

Out[3]=
{{x1, y1}, {x2, y2}, {x3, y2}, {x4, y4}}

In[4]:=
MapThread[List,{x,y}]

Out[4]=
{{x1, y1}, {x2, y2}, {x3, y2}, {x4, y4}}

In[5]:=
Thread[{x,y}]

Out[5]=
{{x1, y1}, {x2, y2}, {x3, y2}, {x4, y4}}

And I am sure there are still others I haven't thought of
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Replacing Numbers in a List
  • Next by Date: Re: {x},{y} -> {x,y} ?
  • Previous by thread: Re: {x},{y} -> {x,y} ?
  • Next by thread: Re: {x},{y} -> {x,y} ?