Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2001

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

Search the Archive

Re: Replacing Parts of a List

  • To: mathgroup at
  • Subject: [mg28760] Re: Replacing Parts of a List
  • From: Ignacio Rodriguez <ignacio at>
  • Date: Fri, 11 May 2001 20:00:38 -0400 (EDT)
  • Organization: UCM
  • References: <9dg63q$>
  • Sender: owner-wri-mathgroup at

I guess you want to do the following:

you have Subscript[x,y] and want to set x=10

What you said seems OK for me:
If you want something simpler, try x=10

If you prefer to have x as a function of Subscript[x,y], then you can use


you may see that lhs is x. As Set has Attribute HoldFirst, lhs is not
evaluated unless you explicitly do so.

Roger Jones wrote:

> 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


Ignacio Rodriguez Ramirez de Arellano
Unidad de RMN
Universidad Complutense
Paseo Juan XXIII, 1
Madrid 28040, Spain

Tel. 34-91-394-3288
Fax  34-91-394-3245
e-mail: ignacio at


  • Prev by Date: Re: How to make curved arrows?
  • Next by Date: DSolve?? solution which is not a solution
  • Previous by thread: Re: Replacing Parts of a List
  • Next by thread: Re: Replacing Parts of a List