Student Support Forum: 'Trouble Manipulating Indexed Lists' topicStudent Support Forum > General > "Trouble Manipulating Indexed Lists"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Rob Gross 12/11/00 11:00am I'm trying to do some list manipulations with a number of lists, so I have indexed each list. For example, mat[1] is a list, mat[2] is a list, and so on. When I try working with these indexed lists, I am having some problems. The best way to illustrate my problems is with this example taken directly from a notebook: Here are two identical lists - one is a ''normal'' list, and one is indexed: In[139]:= testlista={1,2,3,4}; In[140]:= testlistb[1]={1,2,3,4}; Verifying that they are equal: In[142]:= testlista==testlistb[1] Out[142]= True Now when I try assigning 4 to the second element in the indexed list, I receive the following error: In[152]:= testlistb[1][[2]]=4 Set::''setps'': ''\!\(testlistb[1]\) in assignment of part is not a symbol.'' Out[152]= 4 The indexed list has not changed: In[144]:= testlistb[1] Out[144]= {1,2,3,4} When I do the same thing for the ''normal'' list, I receive no errors and it works fine: In[145]:= testlista[[2]]=4 Out[145]= 4 In[146]:= testlista Out[146]= {1,4,3,4} What is going on here? Clearly testlista = testlistb[1], so when I say testlistb[1][[2]] = 4, it should take the second element of testlistb[1], 2, and replace it with 4, but it doesn't. If someone could please tell me what's going on here it would be helpful. Thanks. P.S. I'm using the student version of Mathematica V 3.0. URL: ,

 Subject (listing for 'Trouble Manipulating Indexed Lists') Author Date Posted Trouble Manipulating Indexed Lists Rob Gross 12/11/00 11:00am Re: Trouble Manipulating Indexed Lists Aaron Honecker 12/11/00 2:54pm
 Next Comment > Help | Reply To Topic