RE: RE: Why do parentheses spuriously appear when I type in a formula?
- To: mathgroup at smc.vnet.net
- Subject: [mg34547] RE: [mg34458] RE: [mg34410] Why do parentheses spuriously appear when I type in a formula?
- From: "DrBob" <majort at cox-internet.com>
- Date: Mon, 27 May 2002 01:16:44 -0400 (EDT)
- Reply-to: <drbob at bigfoot.com>
- Sender: owner-wri-mathgroup at wolfram.com
I agree you should be able (somehow) to control this behavior to your satisfaction. However... depending on the audience you're writing for (remember them?)... it is risky to deviate from "convention". It makes sense to me for subscript to have higher precedence (bind tighter, if you will) than superscript --- just as Times has higher precedence than Plus. It will make sense to many people, and I suspect that's why it's done that way in Mathematica. The precedence has to go SOME direction, so you choose one, and in this case it's chosen (unfortunately perhaps) partly because of the confusion of Power with Superscript. Sometimes we want a Superscript NOT to mean Power, and it's difficult to do that. THAT can be really annoying. Bobby -----Original Message----- From: Wolf, Hartmut [mailto:Hartmut.Wolf at t-systems.com] To: mathgroup at smc.vnet.net Subject: [mg34547] RE: [mg34458] RE: [mg34410] Why do parentheses spuriously appear when I type in a formula? > -----Original Message----- > From: DrBob [mailto:majort at cox-internet.com] To: mathgroup at smc.vnet.net > Sent: Thursday, May 23, 2002 7:27 PM > Subject: [mg34547] RE: [mg34458] RE: [mg34410] Why do parentheses spuriously > appear when I type in a formula? > > > >>the b subscript of T raised to the a power > > I read that wrong before. Sorry. > > If you mean (the b subscript of T) raised to the a power, the > keystrokes > are T Ctrl-_ b Ctrl-space Ctrl-^ a, and there are no parentheses. [Hartmut Wolf] Why not? I could argue: who tells subscript it must be effective before supercript applies? The convention is our reading convention left-to-right subscript comes before suberscript, such it comes first. > > If you mean the b subscript of (T raised to the a power), the > keystrokes > are T Ctrl-^ a Ctrl-space Ctrl-_ b, and there MUST be parentheses in > order to distinguish between that and the other answer. If you care. > If you don't, then use the other method and avoid the parentheses. > [Hartmut Wolf] Same argument as above, but now uttered: why? This has nothing to do with care or not, just with easy reading. Don't forget: the interpretation of Superscript as Power comes later at expression formation, and not at box building. But it is there where the parentheses are introduced. There are not wrong, but nasty, esp. if you want to define a tensor with mupltiple co- and contravariant indices (no power in sight) as Carl Woll tried (if I'm right). See a d g (((T ) ) ) b e f h the parentheses are absolutely redundant! I normally don't complaint if my tool doesn't meet my first expectations (or doesn't supply the universal "solve"-button), instead I search for a way to get the best out of it. What disturbs me (and I think Carl too) more is that I found no way to change this behaviour: the first point to intervene is at MakeExpression (which corresponds to the semantic actions of a parser), but everything happend before. > I see no other reasonable way to read it, and I see no reliable way to > visually distinguish between the two forms without > parentheses in one of > them. > > >>You can also check the input which does work: first the subscript, > then the subscript; the ctrl-space escape *is* needed! > > That's obviously a typo... so I still haven't seen the answer you DO > want. > > Bobby > ---snipped--- the cases of input which might read as ambiguous In[25]:= \(T\^a\%b\) Out[25]= SubsuperscriptBox[T,b,a] In[27]:= \(T\_b\%a\) Out[27]= SubsuperscriptBox[T,b,a] aren't because the are mapped to the same internal (and visual) representation -- Hartmut