MathGroup Archive 1999

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

Search the Archive

Re: Subscripts, Doh!!!

David Bailey <db at> wrote:

> I have always found the way Mathematica handles subscripts rather neat.

Me too. Mostly. And it's much better under v4 than v3.

1. A delightful plethora of virtues

With Subscript notation, you can dazzle your friends
and win their confidence. How else can you:

    z = Thread[Subscript[y, Range[12]]]

    z /. Subscript[y, x_] -> s^x

and back again:
    % /. s^x_. -> Subscript[y, x]

or go back a period in time:

    z /. Subscript[y, t_] -> Subscript[y, t-1]

Delicious !

2. Almost as good as symbols

In v4, you can generally use subscripted "variables" as if they were symbols. 
For example:

  In[]:=   expr = y_1 + y_2            ( Here y_1 denotes Subscript[y, 1] ) 
  In[]:=   Solve[expr==2, y_1]       works fine.

  In[]:=   Plot3D[Sin[expr], {y_1, -3, 3}, {y_2, -3, 3}]  works fine.

  In[]:=   Integrate[3 y_1, y_1]     works fine, and so on.

In fact, the only function I can think of that does not handle
Subscripts properly is FindMinimum:  this generally works fine, but
has some problems in complicated cases which are avoided by using
Symbols instead of Subscripts. 

The most common problem occurs when people simultaneously
try to use:

     x   AND   x_1, x_2  etc

They then set 


and get very confused when they get terms such as

     7_1, 7_2, 7_3

These sorts of problems are easily avoided by NOT
simultaneously using x   WITH   x_1, x_2... .

3.  Symbolize ?

Symbolize looks like a pretty amazing piece of work:
trying to retrofit a new framework on an existing structure.
That being said, I must say that I don't like Symbolize.
I shall offer 3 reasons:

(i)  << Utilities`Notation`

 In[]  Symbolize[m ] ;       Symbolize[m  ];      Symbolize[m ];
                  2                     3                    4

  Check that this has worked:
  In[]   m   // Head

  Out[]   Symbol          

  All is well. Now input:

 In[]   z = Table[ m  , {i, 2, 4}]

 In[]   Map[Head, z]
Out[]   {Subscript, Subscript, Subscript}

We now have two sets of "identical" notation in use. 
In the one set, m_2 is a Symbol;  in the other set, m_2 is a Subscript
(not a Symbol). They both look the same on screen. Tres confusing !

(ii) More generally, what you see is NOT what you get
     The Symbolize package uses a palette based entry method. 
     The reason it uses a palette entry system is because underneath, 
     it is adding a much more complicated tag box structure. So while 
     it looks like:
    in fact the full Input story is:


    This makes reproducing results in textbooks very difficult, or cumbersome.

(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.
       But none of this works.

      In an earlier message, Alan Hayes suggested:


      to symbolise ALL subscript objects. 
      Of course, ALL iterators of subscripts then stop working:

      In[]:=   Table[x_i, {i, 4}]          x_i denotes Subscript[x, i]
      Out[]    x_i, x_i, x_i, x_i       



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

  • Prev by Date: Re: Can someone explain this?
  • Next by Date: Re: Animated give out of animated Mathematica?
  • Previous by thread: Re: Subscripts, Doh!!!
  • Next by thread: Re: Subscripts, Doh!!!