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


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

Creating an ordered list of pairs

Started byamannucci <Anthony.J.Mannucci@jpl.nasa.gov>
First post2013-12-01 13:22 +0000
Last post2013-12-02 06:47 +0000
Articles 3 — 3 participants

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


Contents

  Creating an ordered list of pairs amannucci <Anthony.J.Mannucci@jpl.nasa.gov> - 2013-12-01 13:22 +0000
    Re: Creating an ordered list of pairs Szabolcs Horvát <szhorvat@gmail.com> - 2013-12-02 06:45 +0000
    Re: Creating an ordered list of pairs "Dr. Wolfgang Hintze" <weh@snafu.de> - 2013-12-02 06:47 +0000

#16296 — Creating an ordered list of pairs

Fromamannucci <Anthony.J.Mannucci@jpl.nasa.gov>
Date2013-12-01 13:22 +0000
SubjectCreating an ordered list of pairs
Message-ID<l7fd6s$k56$1@smc.vnet.net>
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] | [next] | [standalone]


#16302

FromSzabolcs Horvát <szhorvat@gmail.com>
Date2013-12-02 06:45 +0000
Message-ID<l7haam$pbr$1@smc.vnet.net>
In reply to#16296
On 2013-12-1, 8:22 , amannucci 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.
>

Use Join @@ Table[ ... ] or use Tuples[{Range[1,10], Range[5,20,5]}]

[toc] | [prev] | [next] | [standalone]


#16305

From"Dr. Wolfgang Hintze" <weh@snafu.de>
Date2013-12-02 06:47 +0000
Message-ID<l7hadp$pc5$1@smc.vnet.net>
In reply to#16296
Am Sonntag, 1. Dezember 2013 14:22:36 UTC+1 schrieb amannucci:
> 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

In[19]:= Table[{i, 5*j}, {i, 1, 3}, {j, 1, 3}]

Out[19]= {{{1, 5}, {1, 10}, {1, 15}}, {{2, 5}, {2, 10}, {2, 
   15}}, {{3, 5}, {3, 10}, {3, 15}}}

Best regards,
Wolfgang

[toc] | [prev] | [standalone]


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


csiph-web