MathGroup Archive 2006

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

Search the Archive

Re: Subscript assignment incompatibility??


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


  • Prev by Date: Re: Possible bug concerning a limit computation
  • Next by Date: Re: Simplifying in Mathematica
  • Previous by thread: Re: Subscript assignment incompatibility??
  • Next by thread: Simplifying in Mathematica