MathGroup Archive 2011

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

Search the Archive

Re: Treat subscripted variables as symbols

  • To: mathgroup at
  • Subject: [mg120955] Re: Treat subscripted variables as symbols
  • From: "Alexey Popkov" <lehin.p at>
  • Date: Fri, 19 Aug 2011 06:32:32 -0400 (EDT)
  • Delivered-to:
  • References: <j28emt$3fa$><> <>

----- Original Message ----- 
From: "Ralph Dratman" <ralph.dratman at>
To: "Alexey Popkov" <lehin.p at>
Cc: <mathgroup at>
Sent: Wednesday, August 17, 2011 7:37 PM
Subject: [mg120955] Re: Treat subscripted variables as symbols

> I've started using lists of strings instead of symbols in place of what 
> some
> programming languages refer to as an "enumerated type." I find it 
> difficult
> to keep track of Mathematica's rules of evaluating or not evaluating. I
> guess this arises because Mathematica's language does many different kinds
> of things with symbols, and tries to be transparent for each type of task.
> The result, in terms of references and values and so forth, seems 
> convoluted
> to me.
> That is not a complaint; I'm having a lot of fun with Mathematica. But 
> when
> I want to think like a programmer, I prefer to narrow my view for
> utilitarian purposes. That's why I am using strings -- in effect, building
> my own symbol tables.
> That's wasteful, I'm sure, but so far I can't figure out the right way to 
> do
> it. Has anyone constructed a compiler in Mathematica? If so, that code 
> might
> tell the tale.
> Ralph

You can convert a string containing correct symbol name to a symbol by using 
the Symbol command or by using ToExpression. Note three-argument form of 
This form allows you to pass your symbol to arbitrary function with Hold* 
attribute without evaluating your symbol.

You can find description of the standard evaluation sequence on the top of 
the following Documentation page:
I strongly reccommend to become familiar with the standard evaluation 
sequence bacause it explains many "strange" aspects of expression evaluation 
in Mathematica. Some experiments with the Trace command my help with 
understanding it significantly. You could also try to use WReach's traceView 

  • Prev by Date: Re: Inverse Interpolation
  • Next by Date: Re: why does this call to ListPlot3D crash the kernel?
  • Previous by thread: Re: Treat subscripted variables as symbols
  • Next by thread: Re: Treat subscripted variables as symbols