Re: {x},{y} -> {x,y} ?
- To: mathgroup at smc.vnet.net
- Subject: [mg68267] Re: [mg68241] {x},{y} -> {x,y} ?
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Mon, 31 Jul 2006 03:45:28 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200607300848.EAA25167@smc.vnet.net>
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
Easy -- use Transpose. For example:
x=Table[Random[Real],{4}]
y=Table[Random[Real],{4}]
{0.0762965,0.682301,0.577304,0.357265}
{0.832996,0.00793735,0.917469,0.701247}
xyPairs=Transpose[{x,y}]
{{0.0762965,0.832996},{0.682301,0.00793735},{0.577304,0.917469},
{0.357265,0.701247}}
To check you have what you want, you could now use TableForm[xyPairs].
(Caution: Do NOT assign the result of TableForm[xyPairs] to a variable
or try to operate upon that result as if it were the actual list of
xy-pairs.)
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?
>
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
- References:
- {x},{y} -> {x,y} ?
- From: "AngleWyrm" <anglewyrm@yahoo.com>
- {x},{y} -> {x,y} ?