Student Support Forum: 'Problem with looping.' topicStudent Support Forum > General > "Problem with looping."

 Next Comment > Help | Reply To Topic
 Author Comment/Response A. Wong 11/28/09 7:49pm Trying to do some cellular automata but having trouble with an update function. When i run the update function it gives me something like this: Set::setps: {{-20.1879,21.1748},{62.8569,85.},{59.7414,-58.9272},{-25.3293,36.1174},{91.5649,-77.5145},<<42>>,{-32.3608,-91.3138},{-39.4355,88.9865},{57.58,95.9021},<<50>>} in the part assignment is not a symbol. >> Heres my code students = Table[ RandomReal[{-100, 100}, 2] , {100} ]; visualize[dots_] := ListPlot[dots, ImageSize -> 400, PlotStyle -> AbsolutePointSize[10], AspectRatio -> Automatic, Frame -> True, Axes -> False, PlotRange -> {{-100, 100}, {-100, 100}} ]; probability = Table[0, {100}]; i = 1; While[i < Length[students] + 1, musicLike = (.5) RandomReal[1]; height = (.3) RandomReal[1]; amtMoney = (.2) RandomReal[1]; probability[[i]] = musicLike + amtMoney + height; i++ ] (*ERROR OCCURS AT THIS FUNCTION*) update[input_] := Module[{}, Do[ input[[i]] = input[[i]] (.9) + {2, 2} , {i, Length[input]} ]; Return[input]; ] simulate[initialAg_] := Manipulate[ Refresh[ If[updating || onestep, t++; onestep = False; ag = update[ag] ]; Show[visualize[ag], PlotLabel -> "t = " <> ToString[t]] , UpdateInterval -> If[updating, 0, Infinity] ] , {{t, 0}, ControlType -> None}, {{ag, initialAg}, ControlType -> None}, {{onestep, False}, ControlType -> None}, {{updating, False, "Run simulation"}, {True, False}}, Button["Update one step", onestep = True], Button["Reset", updating = False; ag = initialAg; t = 0], SynchronousUpdating -> True, SaveDefinitions -> True ]; simulate[students] URL: ,

 Subject (listing for 'Problem with looping.') Author Date Posted Problem with looping. A. Wong 11/28/09 7:49pm Re: Problem with looping. yehuda ben-s... 11/30/09 05:51am
 Next Comment > Help | Reply To Topic