MathGroup Archive 2008

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

Search the Archive

Re: silly problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85310] Re: silly problem
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Tue, 5 Feb 2008 19:44:11 -0500 (EST)
  • References: <fo9g1h$sbm$1@smc.vnet.net>

Francis Bitonti wrote:
> I'm new to Mathematica so this is a very basic question I think. but on=
e
> that has me hung up. I keep getting this error
>
> Set::write: Tag List in {0,0,0,0,0,0,0,0}[1] is Protected. >>

Most probably you had something assigned to 'k', e.g.

In[1]:= k = {1, 2}
Out[1]= {1, 2}

In[2]:= k[1] = 2

During evaluation of In[2]:= Set::write: Tag List in {1,2}[1] is \
Protected. >>

Out[2]= 2

>
>
> my code looks like this.
>
> *IN:*
> For[i = 1, i < 6 , i++,
>  Print[
>   g = i;
>   k[g] = twoDcalc[e1, a1, nodes[[{edges[[g, 1]], edges[[g, 2]]}]]]
>   ]]

You might find is useful to avoid functions like For[] and explicit
assignments inside calculations, so that these kind of variable-name
collisions do not occur.  Or just use Module[] to localize variables.


Szabolcs Horv=E1t


  • Prev by Date: Re: Equi-sized tick labels
  • Next by Date: Positioning in CellFrameLabels
  • Previous by thread: Re: silly problem
  • Next by thread: Re: silly problem