MathGroup Archive 2007

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

Search the Archive

Re: subscripted local variables?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80638] Re: subscripted local variables?
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Tue, 28 Aug 2007 02:02:13 -0400 (EDT)
  • Organization: University of Bergen
  • References: <fath6p$3o7$1@smc.vnet.net>

Yaroslav Bulatov wrote:
> What is the recommended way of declaring subscripted local variables?
> 
> For instance the following is an error in Mathematica 6.0
> Module[{Subscript[x, a]}, Subscript[x, a] = 5]

IMO, it is generally a bad idea to use subscripted variables in 
Mathematica, because you are assigning to Subscript[].  This leads to 
all kinds of problems, e.g. with clearing the variable.

Or try
z = Subscript[x, a]
a = 1
z
x = 2
z

Just use xa or x[esc]_[esc]a instead.  Subscripted variables are not 
worth the trouble.

Szabolcs



  • Prev by Date: Re: Problem with With
  • Next by Date: Problems minimizing an overconstrained system
  • Previous by thread: subscripted local variables?
  • Next by thread: Re: subscripted local variables?