MathGroup Archive 2008

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

Search the Archive

Re: Getting rid of those deprecated Do[] loops?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92826] Re: Getting rid of those deprecated Do[] loops?
  • From: AES <siegman at stanford.edu>
  • Date: Tue, 14 Oct 2008 04:58:17 -0400 (EDT)
  • Organization: Stanford University
  • References: <gcsctj$8mj$1@smc.vnet.net> <gcv77o$dse$1@smc.vnet.net>

In article <gcv77o$dse$1 at smc.vnet.net>,
 "sjoerd.c.devries at gmail.com" <sjoerd.c.devries at gmail.com> wrote:

> Multidimensional iteration is the sixth of the possible formats
> described in the documentation of the Table and Do functions. The
> construction that surprised you is the fifth one. Actually, you are
> able to iterate over an arbitrary list of objects.
> 
> Cheers -- Sjoerd

It's not obvious to me from either of those that the iterator "i" itself 
can be a multi-dimensional variable -- though it seems to be the case.

For example, could I write an iterator of the form

   { {i,j} , { {i1,j1}, {i2,j2}, . . .}}

or something similar, and then use i and j in the Table entries, instead 
writing this in the form

   { k , { {i1,j1}, {i2,j2}, . . .}}

and then using k[[1],  k[[2]] in the Table entires?

And the sixth format does not produce the output that I wanted without 
using Flatten -- which is an OK function, except you have to learn and 
understand it well enough to know whether you do or do not need the "1" 
in the second argument to get what you want.


  • Prev by Date: Re: naive question
  • Next by Date: Re: loops?
  • Previous by thread: Re: Getting rid of those deprecated Do[] loops?
  • Next by thread: Re: Getting rid of those deprecated Do[] loops?