MathGroup Archive 1999

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

Search the Archive

Re: Subscripts, Doh!!!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19298] Re: Subscripts, Doh!!!
  • From: Colin Rose <colin at tri.org.au>
  • Date: Sat, 14 Aug 1999 01:45:20 -0400
  • References: <7o5ier$rme@smc.vnet.net> <7oba5o$3p6@smc.vnet.net> <"199908060358.XAA08108"@smc.vnet.net> <v04210100b3d0c0366e0b@[172.16.41.9]> <199908120524.BAA04506@smc.vnet.net.> <37B31C8D.94FD0C1E@u.washington.edu>
  • Sender: owner-wri-mathgroup at wolfram.com

> Colin Rose wrote:
>
>>The most common problem occurs when people simultaneously
>>try to use:
>>
>>     x   AND   x_1, x_2  etc
>>
>>They then set
>>
>>    x=7,
>>
>>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... .



and Carl Woll replied:


>Like you, I like subscripts and I don't like to use the Symbolize 
>function. You mentioned a few things that go wrong when you use 
>subscripts, and I have some proposed solutions.

>An alternative solution to avoidance is to give Subscript the 
>attribute HoldFirst. For example,
>
>In[102]:=      SetAttributes[Subscript,{HoldFirst}]
>
>In[104]:=      t=1
>               Subscript[t,1]
>
>Out[104]=      1
>
>Out[105]=      t
>                1



Carumbah !!

This is so clever, so elegant, so nice. Oh I must have this.

       **  Why isn't this the default behaviour under v4 ?  **

I can't fault it. It's extremely unlikely to break any code
(since subscript tricks are usually performed with -> , and
these work as before).  And it resolves the most common problem
with using subscript notation in Mathematica, especially with
new users.

Now I can set mu = 3.97, and simultaneously
work with symbolic moments such as mu_1, mu_2 etc.

Most excellent.

Cheers and thanks

Colin
 







Colin Rose
tr(I)    -  Theoretical Research Institute
__________________________________________
colin at tri.org.au    http://www.tri.org.au/


 






  • Prev by Date: Re: Defining a function P[A_ | B_]:=f[A,B] overriding Alternatives
  • Next by Date: Re: circumference of an ellipse
  • Previous by thread: Re: Re: Subscripts, Doh!!!
  • Next by thread: Re: Re: Subscripts, Doh!!!