MathGroup Archive 1999

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

Search the Archive

Re: Subscripts, Doh!!!


> 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!!!