Re: How to create {{x1,y1}, ..., {xn,yn}} data from {x1,...,xn} and {y1, ..., yn}
- To: mathgroup at smc.vnet.net
- Subject: [mg63803] Re: [mg63755] How to create {{x1,y1}, ..., {xn,yn}} data from {x1,...,xn} and {y1, ..., yn}
- From: ggroup at sarj.ca
- Date: Sat, 14 Jan 2006 02:33:37 -0500 (EST)
- References: <200601130948.EAA03554@smc.vnet.net>
- Reply-to: ggroup at sarj.ca
- Sender: owner-wri-mathgroup at wolfram.com
Hi Young-jin,
On Friday, January 13, 2006 at 04:48 GMT -0500, Youngjin.Michael wrote:
<snip>
> 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}.
There are many ways, but the fastest is:
list1 = {x1,...,xn};
list2 = {y1,...,yn};
desiredlist = Transpose[{list1,list2}]
> I also would like to know if a user-defined function in Mathematica can
> have more than one statements in its body.
There are many ways. Check out Module[], Block[], Function[] or () to
enclose the statements. Remember, statements need to be separated by ;
when grouped together. For example:
myFunc[x_]:=Module[{y=x^2,z},
z = 2*y+5;
z/x]
- References:
- How to create {{x1,y1}, ..., {xn,yn}} data from {x1,...,xn} and {y1, ..., yn}
- From: "youngjin.michael@gmail.com" <youngjin.michael@gmail.com>
- How to create {{x1,y1}, ..., {xn,yn}} data from {x1,...,xn} and {y1, ..., yn}