Re: Subscript assignment incompatibility??

*To*: mathgroup at smc.vnet.net*Subject*: [mg71125] Re: Subscript assignment incompatibility??*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Thu, 9 Nov 2006 03:37:24 -0500 (EST)*Organization*: The Open University, Milton Keynes, UK*References*: <eisgrm$nk6$1@smc.vnet.net>

kevin_jazz wrote: > I have another very simple problem: > x={{1,28},{2,28}} > Subscript[p,res] = x > > x[[1]]=x[[1]] > {1,28} > > Subscript[p,res][[1]] = Subscript[p,res][[1]] > > \!\(Set::"setps" : \ "\!\(p\_res\) in assignment of part is not a > symbol."\) > > So, I can't make an assignment with a variable that has a subscript?? Right, you cannot. According to the online help, the above message is ". Generated when a part assignment is used for the value of an expression other than a symbol. . Part assignments are implemented only for parts of the value of a symbol." Now, for Mathematica, a subscripted name is *not* a symbol. So you can either change the name as in the following example: In[1]:= Block[{x},x[1]={0,0,0};x[1][[2]]=11;x[1]] From In[1]:= Set::setps: x[1] in assignment of part is not a symbol. Out[1]= {0,0,0} This shows a valid part assignment. In[2]:= Block[{x1},x1={0,0,0};x1[[2]]=11;x1] Out[2]= {0,11,0} Or use the *Symbolize* function from the package "Utilities`Notation`" Regards, Jean-Marc