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


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

Creating List

Started byHarry <hvdosten@gmail.com>
First post2012-03-17 07:53 +0000
Last post2012-03-18 07:51 +0000
Articles 4 — 4 participants

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


Contents

  Creating List Harry <hvdosten@gmail.com> - 2012-03-17 07:53 +0000
    Re: Creating List Peter Pein <petsie@dordos.net> - 2012-03-18 07:44 +0000
    Re: Creating List Ray Koopman <koopman@sfu.ca> - 2012-03-18 07:47 +0000
    Re: Creating List Murta <rodrigomurtax@gmail.com> - 2012-03-18 07:51 +0000

#9098 — Creating List

FromHarry <hvdosten@gmail.com>
Date2012-03-17 07:53 +0000
SubjectCreating List
Message-ID<jk1ft6$50r$1@smc.vnet.net>
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


[toc] | [next] | [standalone]


#9108

FromPeter Pein <petsie@dordos.net>
Date2012-03-18 07:44 +0000
Message-ID<jk43oh$dsh$1@smc.vnet.net>
In reply to#9098
Am 17.03.2012 08:53, schrieb Harry:
> 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
>
>
>

Hi,

  the easiest way is to copy the list from your question and.. ;-)

Here is another way:

With[{iend = 4, jend = 3},
  Flatten[Table[{xkoord[i], ykoord[j]}, {j, jend}, {i, iend}], 1]
  ]

Peter

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


#9115

FromRay Koopman <koopman@sfu.ca>
Date2012-03-18 07:47 +0000
Message-ID<jk43v9$e04$1@smc.vnet.net>
In reply to#9098
On Mar 17, 12:53 am, Harry <hvdos...@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]}}

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


#9123

FromMurta <rodrigomurtax@gmail.com>
Date2012-03-18 07:51 +0000
Message-ID<jk446v$e1r$1@smc.vnet.net>
In reply to#9098
Hi!
Maybe this solve your problem

li = Table[xkoor[i], {i, 1, iend}]
lj = Table[ykoor[j], {j, 1, jend}]
Tuples[{li, lj}]

Best Regards
Murta

On Mar 17, 4:53 am, Harry <hvdos...@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

[toc] | [prev] | [standalone]


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


csiph-web