Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Subscripts, Doh!!!

  • To: mathgroup at
  • Subject: [mg19269] Re: Subscripts, Doh!!!
  • From: Colin Rose <colin at>
  • Date: Thu, 12 Aug 1999 01:24:24 -0400
  • References: <7o5ier$> <7oba5o$> <"199908060358.XAA08108"> <v04210100b3d0c0366e0b@[]>
  • Sender: owner-wri-mathgroup at

Jason Harris wrote:

>Just using subscripted symbols has its problems though...
>For instance  \!\(\(?m\_1\)\), that is ? m sub 1 will yield an 
>error. As will something like \!\(Clear[m\_1]\), that is Clear[ m 
>sub 1]. etc.

Yes - it would have been nice if Clear[Subscript[m, 1]] had
been 'made to work' in v4. At the moment, one has to use

    Unset[Subscript[m, 1]]


    Clear[Subscript]       (which clears all subscripted 'variables').


>>(iii)  Ideally, one would be able to
>>      Symbolize[ Subscript[x, _Integer] ]
>>     and then be able to work with
>>            Table[x_i, {i, 1, 4}]
>>     where each of x_1, x_2, x_3 etc are treated as symbols.

>Here is some code to do what you request. (It looks much better on 
>screen than below. It takes only 3 lines on screen.)
>      SubscriptBox["m",
>        TagBox[RowBox[List["i_", "?", "unparsedNumericQ"]],
>          NotationPatternTag,
>          Rule[TagStyle, "NotationPatternWrapperStyle"]]]]]
>Subscript[m, i_?IntegerQ] := ToExpression @ MakeBoxes @ Subscript[m, i]
>unparsedNumericQ  @  boxes___ :=
>  ReleaseHold @
>    Hold[NumericQ] @
>      Hold[Unevaluated] @ ToExpression[boxes, StandardForm, Hold]
>The function UnparsedNumericQ carefully tries to determine if a 
>string is a number without evaluating it.
>Here is an illustrative example. (Assuming the Notation package has 
>been loaded and the above code entered.)
>\!\(Table[m\_i, {i, 1, 3}] === {m\_1, m\_2, m\_3}\)

Neat. Can you make this work for Greek symbols too,
say mu_1, mu_2 etc, rather than just m_1, m_2, m_3  ?

[  Actually, I had better not advocate such things, or
    a lot of my code will cease to work ! heh heh      ]

> Of course, this is all possible programmatically so one can
> easily define a function to automate this.

I think it would be valuable if you could add such features to
the next version of Symbolize, in an easily accessible manner.
For instance:

       Symbolize[ Subscript[x, _Integer]

switches the above on, for just symbol x,

       Symbolize[ Subscript[x_, _Integer]

might do it more generally.

Cheers and thanks


Colin Rose
tr(I)    -  Theoretical Research Institute
colin at


  • Prev by Date: Re: Win32 MathLink .exe from Matheamtica 3 on a Mac
  • Next by Date: Please Help
  • Previous by thread: Re: Subscripts, Doh!!!
  • Next by thread: Re: Re: Subscripts, Doh!!!