[Date Index]
[Thread Index]
[Author Index]
Re: Subscripts, Doh!!!
*To*: mathgroup at smc.vnet.net
*Subject*: [mg19128] Re: Subscripts, Doh!!!
*From*: colin at tri.org.au (Colin Rose)
*Date*: Thu, 5 Aug 1999 23:58:35 -0400
*Organization*: Theoretical Research Institute
*References*: <7o5ier$rme@smc.vnet.net> <7oba5o$3p6@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
David Bailey <db at salford-software.com> 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
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... .
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
2
Out[] Symbol
All is well. Now input:
In[] z = Table[ m , {i, 2, 4}]
i
In[] Map[Head, z]
Out[] {Subscript, Subscript, Subscript}
OUCH !
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:
Symbolize[x_2]
in fact the full Input story is:
Symbolize[NotationBoxTag[\(x\_2\)]]
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:
Symbolize[NotationBoxTag[\(_\__\)]];
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
Cheers
Colin
--
Colin Rose
tr(I) - Theoretical Research Institute
__________________________________________
colin at tri.org.au http://www.tri.org.au/
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!!!**
| |