Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: How to create this kind of list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122148] Re: How to create this kind of list
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Sun, 16 Oct 2011 07:08:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j7bm30$35r$1@smc.vnet.net>

You can use Transpose[] like this

n = 3;
va = Table[a[i], {i, 1, n}]
vb = Table[b[i], {i, 1, n}]
    {a[1], a[2], a[3]}
    {b[1], b[2], b[3]}
Transpose[{va, vb}]
    {{a[1], b[1]}, {a[2], b[2]}, {a[3], b[3]}}
--- Wolfgang



"Szymon Roziewski" <szymon.roziewski at gmail.com> schrieb im Newsbeitrag 
news:j7bm30$35r$1 at smc.vnet.net...
> Hello there,
> I am thinking about creating such a list.
> I have 2 lists with the same number of elements.
> The idea is to create one list which was taken from these previous 
> two ones
> in the following way:
> Take one element of the first list and one from another and put it 
> into
> result list {{x1,y1},{x2,y2},...,{xn,yn}}.
> Input lists:
> A={x1,x2,...,xn}
> B={y1,y2,...,yn}
>
> All best,
> Szymon Roziewski 




  • Prev by Date: Re: Only real data
  • Next by Date: Re: A collection of Mathematica learning resources
  • Previous by thread: Re: How to create this kind of list
  • Next by thread: Re: How to create this kind of list