MathGroup Archive 1996

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

Search the Archive

Re: indices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3604] Re: indices
  • From: Xah Lee <xah at best.com>
  • Date: Thu, 28 Mar 1996 00:09:09 -0500
  • Organization: Best Internet Communications
  • Sender: owner-wri-mathgroup at wolfram.com

FERRUCCIO Renzoni wrote:

> in a long program I use the same indices several times and I don't know
> when it is necessary use Module[ ] to avoid interference.
> For exemple:
> ...
> it is necessary Module[ ] ?

It is not necessary. See the message by Robby

>Re: iterator strings as lists? 
>Date: 22 Mar 1996 08:35:20 GMT 
>From: villegas at buka.wri.com (Robert Villegas)
To: mathgroup at smc.vnet.net

in this group. Here's an excerpt:

> Actually, another reason, documented in the book, is that the index
> variables are protected from global values during the Table
> (the same type of scoping Block uses).  So if you've assigned values
> to x and y,
> 
> In[1]:= {x, y} = {4, 3};
> 
> you can still construct tables using x and y as iteration variables:
> 
> In[2]:= Table[f[x, y], {x, 3}, {y, 4}]
> 
> Out[2]= {{f[1, 1], f[1, 2], f[1, 3], f[1, 4]},
>  
> >    {f[2, 1], f[2, 2], f[2, 3], f[2, 4]},
>  
> >    {f[3, 1], f[3, 2], f[3, 3], f[3, 4]}}
> 
> 
> If arguments beyond the first will pre-evaluated, then this wouldn't
> work:
> 
> In[3]:= Attributes[Table] = Attributes[Table] /. HoldAll -> HoldFirst;
> 
> In[4]:= Table[f[x, y], {x, 3}, {y, 4}]
> 
> Table::itraw: Raw object 4 cannot be used as an iterator.
> 
> Out[4]= Table[f[x, y], {4, 3}, {3, 4}]
> 
> 
> Robby Villegas

 Xah
 xah at best.com
 74631.731 at compuserve.com
 http://www.best.com/~xah/
 Quote of the day: "Mathematics, when view from the right angle, can be as boring as 
possible"  --Mathfolklore.

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Fourier? (Q)
  • Next by Date: Re: packages
  • Previous by thread: Re: Fourier? (Q)
  • Next by thread: 3D real-time Visualization