Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Re: RandomReal gets stuck

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100535] Re: [mg100528] Re: RandomReal gets stuck
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 7 Jun 2009 05:01:21 -0400 (EDT)
  • References: <200906061025.GAA04602@smc.vnet.net>
  • Reply-to: drmajorbob at bigfoot.com

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[SubscriptBox[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

On Sat, 06 Jun 2009 05:25:42 -0500, Bill Rowe <readnews at sbcglobal.net>  
wrote:

> On 6/5/09 at 3:04 AM, bastraat at ucalgary.ca (Bas Straatman) wrote:
>
>> Apparently there is more to it than meets the eye, but section 2.5.5
>> in the (old) mathematica book discusses the use of indexed objects.
>
> In the fourth edition of the Mathematica Book, it is section
> 2.4.5 titled Making Definitions for Indexed Objects *briefly*
> discusses using the syntax y[[0] etc as a "subscripted"
> variable. Basically, this section shows an example where it is
> more convenient to use this syntax over a list and has the
> following statement:
>
> You can think of the expression a[i] as being like an "indexed"
> or "subscripted" variable.
>
> None of what I've said really contradicts this. What I've done
> is simply point out "being like" is not the same as "being".
> That is, there are similarities between a subscripted variable
> and the syntax a[i] but there is not an identity relationship.
>
>
>



-- 
DrMajorBob at bigfoot.com


  • Prev by Date: Re: interfacing odd usb device to mathematica
  • Next by Date: Re: MergeSort with replacerepeated
  • Previous by thread: Re: RandomReal gets stuck
  • Next by thread: Re: RandomReal gets stuck