Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16307 > unrolled thread

Re: Creating an ordered list of pairs

Started byBob Hanlon <hanlonr357@gmail.com>
First post2013-12-02 06:50 +0000
Last post2013-12-02 06:50 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Creating an ordered list of pairs Bob Hanlon <hanlonr357@gmail.com> - 2013-12-02 06:50 +0000

#16307 — Re: Creating an ordered list of pairs

FromBob Hanlon <hanlonr357@gmail.com>
Date2013-12-02 06:50 +0000
SubjectRe: Creating an ordered list of pairs
Message-ID<l7hakj$pci$1@smc.vnet.net>
Use Flatten or Join


xy = Flatten[
  Table[{x, y}, {x, 1, 3}, {y, 5, 15, 5}],
  1]


{{1, 5}, {1, 10}, {1, 15}, {2, 5}, {2, 10}, {2, 15}, {3, 5}, {3, 10}, {3,
15}}


or


xy = Join @@
  Table[{x, y}, {x, 1, 3}, {y, 5, 15, 5}]


{{1, 5}, {1, 10}, {1, 15}, {2, 5}, {2, 10}, {2, 15}, {3, 5}, {3, 10}, {3,
15}}


% == %%


True



Bob Hanlon




On Sun, Dec 1, 2013 at 8:23 AM, amannucci
<Anthony.J.Mannucci@jpl.nasa.gov>wrote:

> How do I create an ordered list of pairs of the following structure:
> {{x1,y1}, {x2,y2}, {x3,y3}, ...} ? I want x1, x2, and x3 to be increasing
> in constant-interval steps (e.g. 1,2,3) and similarly for the y's (e.g.
> 5,10,15). E.g.
> {{1,5}, {1,10}, {1,15}, {2, 5}, {2,10}, ...} etc.
>
> I cannot figure out how to do this with Table or Array. Is there another
> function that will do this?
>
> Table does not create the correct nesting or structure.
>
> Thanks!
>
> -Tony
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web