MathGroup Archive 2007

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

Search the Archive

Re: subscripted local variables?


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?