Replacing Parts of a List
- To: mathgroup at smc.vnet.net
- Subject: [mg28742] Replacing Parts of a List
- From: Roger Jones <rmj at SLAC.Stanford.EDU>
- Date: Fri, 11 May 2001 03:38:58 -0400 (EDT)
- Organization: Stanford Linear Accelerator Center
- Sender: owner-wri-mathgroup at wolfram.com
Given x={1,2} then setting part 1 to 10 (say) is done via x[[1]]=10. This appealing as it is a condensed notation and is I believe, very efficient for large arrays. However, with a subscripted symbol (such as Subscript[x,y]) how is it done? It can be achieved with Subscript[x,y]=ReplacePart[Subscript[x,y],10,1] but this is a little unwieldy. Is there some method (using Hold[Subscript[x,y]] or something like this) that allows a direct replacement? Thank you! -Roger Jones