Re: Replacing Parts of a List
- To: mathgroup at smc.vnet.net
- Subject: [mg28773] Re: [mg28742] Replacing Parts of a List
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sat, 12 May 2001 01:36:41 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
As I tried to point out the first time, you can do:
In[1]:=
l=Subscript[x,y]={1,2,3}
Out[1]=
{1,2,3}
In[2]:=
l[[3]]=10
Out[2]=
10
In[3]:=
Subscript[x,y]
Out[3]=
{1,2,3}
I think this is really not that much more inconvenient than what you
originally tried to do, is it?
--
Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/~andrzej/
on 01.5.12 10:40 AM, Jones, Roger M. at rmj at SLAC.Stanford.EDU wrote:
> To clarify
>
> In[1]:=Subscript[x, y] = {1, 2, 3}
>
> Out1]={1, 2, 3}
>
> To replace the third element I must use :
>
> In[2]:=Subscript[x, y] = ReplacePart[Subscript[x, y], 10, 3]
>
> Out[2]={1, 2,10}
>
> So that now Subscript[x, y] gives:
>
> In[3]:=Subscript[x, y]
>
> Out[3]={1, 2, 10}
>
>
> This is unwieldy and I was hoping for a little more condensed notation.
> However,
> when using subscripts this appears appears to be the simplest notation
> available.
>
> -Roger Jones
>
>