MathGroup Archive 2004

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

Search the Archive

Re: Notation Question

In article <c5lfds$bqh$1 at>,
 scohen at (Sebastian Cohen S) wrote:

> I need to make Mathematica understand that:
> Subscript[X,j] for j = 3
> for example is Part[X,3] and more generally to understand that:
> the input should internally handle Subscript[exp, i,j] 
> as Part[exp, i,j]


 x = {{a,b},{c,d},{e,f}};


 Subscript[x,j__] := x[[j]]

does what you want.

Note that you can use a subscripted form of indexing using [[ ]] 
_without_ any definitions. For example, if paste the following into a 

  Cell[BoxData[SubscriptBox["x", RowBox[{"\[LeftDoubleBracket]", "3",  
    "\[RightDoubleBracket]"}]]], "Input"]

and then evaluate it. This automatically works in the general case.


Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at 

  • Prev by Date: Re: Adding hyperlinks to help browser files in function::usage
  • Next by Date: Re: number of switches
  • Previous by thread: Notation Question
  • Next by thread: Re: Notation Question