Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Notation Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47550] Re: Notation Question
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Thu, 15 Apr 2004 05:02:16 -0400 (EDT)
  • Organization: The University of Western Australia
  • References: <c5lfds$bqh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <c5lfds$bqh$1 at smc.vnet.net>,
 scohen at cable.net.co (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]

If 

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

then

 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 
Notebook,

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

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

Cheers,
Paul

-- 
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 physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • 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