Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Creating List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125539] Re: Creating List
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Sun, 18 Mar 2012 02:41:48 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jk1ft6$50r$1@smc.vnet.net>

On Mar 17, 12:53 am, Harry <hvdos... at gmail.com> wrote:
> Hi out there,
>
> I have calculated some x- and y-values and want to combine them in a
> way that the x and y-values define coordinates. Well, I have:
>
> xkoor[i], {i, 1, iend} and
> ykoor[j], {j, 1, jend}
>
> To be able to continue I need this list:
>
> {{xkoor[1],ykoor[1]},
>  {xkoor[2],ykoor[1]},
>  {xkoor[3],ykoor[1]},
>  {xkoor[4],ykoor[1]},
>  {xkoor[1],ykoor[2]},
>  {xkoor[2],ykoor[2]},
>  {xkoor[3],ykoor[2]},
>  {xkoor[4],ykoor[2]},
>  {xkoor[1],ykoor[3]},
>  {xkoor[2],ykoor[3]},
>  {xkoor[3],ykoor[3]},
>  {xkoor[4],ykoor[3]}}
>
> and have no idea how to get this. So I would be very happy to get any
> small hint...
>
> Thanks a lot,
>
> Harald

Tuples@{Array[x,4],Array[y,3]}

{{x[1], y[1]},
 {x[1], y[2]},
 {x[1], y[3]},
 {x[2], y[1]},
 {x[2], y[2]},
 {x[2], y[3]},
 {x[3], y[1]},
 {x[3], y[2]},
 {x[3], y[3]},
 {x[4], y[1]},
 {x[4], y[2]},
 {x[4], y[3]}}

Reverse/@Tuples@{Array[y,3],Array[x,4]}

{{x[1], y[1]},
 {x[2], y[1]},
 {x[3], y[1]},
 {x[4], y[1]},
 {x[1], y[2]},
 {x[2], y[2]},
 {x[3], y[2]},
 {x[4], y[2]},
 {x[1], y[3]},
 {x[2], y[3]},
 {x[3], y[3]},
 {x[4], y[3]}}



  • Prev by Date: Re: replace one rule in a list of rules
  • Next by Date: Re: Creating List
  • Previous by thread: Re: Creating List
  • Next by thread: Re: Creating List