Re: RE: Joining lists
- To: mathgroup at smc.vnet.net
- Subject: [mg37842] Re: [mg37824] RE: [mg37810] Joining lists
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Fri, 15 Nov 2002 01:34:47 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Not doing what? Do (in Mathematica, not other languages) produces no output! For example: In[6]:= a=3; In[7]:= Do[a,{20}] You can use Do to produce side-effects, as in: In[8]:= Do[Print[a],{20}] If you want output use Table. In fact Flatten[Table[{{a[[i]],b[[i]]}},{i,3}],1] is another way o get your output, but of course Transpose[a,b] is much nicer. On Thursday, November 14, 2002, at 08:11 PM, Pigeon, Robert wrote: > Sorry... I just cut and paste from a Notebook! > > Here what I am trying to do: > a={1,2,3}; > b={4,5,6}; > c={{a[[1]],b[[1]]},{a[[2]],b[[2]]},{a[[3]],b[[3]]}} > {{1,4},{2,5},{3,6}} > > I tried: Do[{{a[[i]],b[[i]]}},{i,3}] And it is not working. > > Since my first posting I found that Transpose[{a,b}] will do it. > > But I would like to know why the Do loop is not doing it ! > > Thanks, > > Robert > > -----Original Message----- > From: Pigeon, Robert [mailto:Robert.Pigeon at drdc-rddc.gc.ca] To: mathgroup at smc.vnet.net > To: mathgroup at smc.vnet.net > Subject: [mg37842] [mg37824] [mg37810] Joining lists > > > Good day, > Here what I am trying to do: > <<...OLE_Obj...>> > <<...OLE_Obj...>> > <<...OLE_Obj...>> > <<...OLE_Obj...>> > Of course my two lists are a lot larger ! So, I would like to build > the new > list c automatically, from the first item to the last of my lists > (number of > items is equal in both lists). I tried: > <<...OLE_Obj...>> > <<...OLE_Obj...>> > and other things. But it does not work. > > At the end I want to plot (ListPlot) the new list. > > Any suggestion? > > Thanks > > > Robert Pigeon > > > > > Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/