Re: RandomReal gets stuck
- To: mathgroup at smc.vnet.net
- Subject: [mg100687] Re: RandomReal gets stuck
- From: Alexey <lehin.p at gmail.com>
- Date: Thu, 11 Jun 2009 07:07:36 -0400 (EDT)
- References: <200906061025.GAA04602@smc.vnet.net> <h0fvjl$rb1$1@smc.vnet.net>
On 7 =C9=C0=CE, 13:00, DrMajorBob <btre... at austin.rr.com> wrote: > If you want to use subscripted variables, it might help to use this code: > > subFunction::usage = "subFunction[a] causes inputting a[i] or \ > \!\(\*SubscriptBox[\"a\", \"i\"]\) to be synonymous, while always \ > displaying the latter in outputs." > > "subFunction[a] causes inputting a[i] or \!\(\*SubscriptBox[\"a\", \ > \"i\"]\) to be synonymous, while always displaying the latter in \ > outputs." > > subFunction[a_Symbol]:=Block[{aa=ToString[a]},MakeExpression[Subscrip= tBox[ToString@a,i_],f_]:=MakeExpression[RowBox[{ToString@a,"[",i,"]"}]];MakeBoxes[a[i_],f_]:=SubscriptBox[MakeBoxes[a,f],MakeBoxes[i,f]]] > > The result is that you can refer to a[i] or Subscript[a,i] > interchangeably, but it always displays in the subscripted form. I find it > much easier to use a[i] while typing formulas, so I'm getting the best of > both worlds. > > Not sure if that addresses everything brought up on the thread, of course. > > Bobby It is very interesting, thank you. But as I understand the definition aa=ToString[a] inside Block is not necessary. And Mathematica does not recognizes input Subscript[a,i] as equivalent to a[i]. There seems to be some errors in the code.
- References:
- Re: RandomReal gets stuck
- From: Bill Rowe <readnews@sbcglobal.net>
- Re: RandomReal gets stuck