Re: How to create {{x1,y1}, ..., {xn,yn}} data from {x1,...,xn} and {y1, ..., yn}
- To: mathgroup at smc.vnet.net
- Subject: [mg63773] Re: How to create {{x1,y1}, ..., {xn,yn}} data from {x1,...,xn} and {y1, ..., yn}
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 14 Jan 2006 02:32:14 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <dq7ual$3sk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
youngjin.michael at gmail.com wrote: > Hello, > > I would like to know how to create a table format data such as {{x1, > y1}, {x2, y2}, ..., {xn, yn}} from > {x1, x2, ..., xn} and {y1, y2, ..., yn}. > > I also would like to know if a user-defined function in Mathematica can > have more than one statements in its body. > > Thanks in advance. > > Young-Jin > Hi Young-Jin, *Transpose* will do what you want. In[1]:= xlist = {x1, x2, x3} ylist = {y1, y2, y3} Transpose[{xlist, ylist}] Out[1]= {x1, x2, x3} Out[2]= {y1, y2, y3} Out[3]= {{x1, y1}, {x2, y2}, {x3, y3}} Best regards, /J.M.