I am attempting to make a small interactive plot that displays the plot of Cos iterated its times. Whenever I try to evaluate my cell, however, I get a Nest:intnm error, something like:
Nest::intnm: Non-negative machine-sized integer expected at position 3 in Nest[Cos,0.000128356,100].
As you can see, the 3rd argument for Nest is an integer, but Mathematica is not happy with it. Here is my code:
DynamicModule[{its=100},Column[{Plot[Nest[Cos,x,Dynamic[its]],{x,0,2\[Pi]}],Slider[Dynamic[its],{1,500,1}]}]]
I've tried changing Nest[Cos,x,Dynamic[its]] to Nest[Cos,x,IntegerPart[Dynamic[its]]] (so as to catch any sort of glitch where 100 was not seen as an integer) with no avail. This is my first time dealing with anything dynamic, or even sliders, so any help is appreciated.
Dynamic[its]is not an integer. How aboutManipulate[ Plot[Nest[Cos, x, its], {x, 0, 2 \[Pi]}], {{its, 1, "its"}, Range[1, 500], ControlType -> Slider}]? – b.gates.you.know.what Jun 26 '13 at 07:38Dynamic[Plot[...rather thanPlot[..Dynamic[its]]? – cormullion Jun 26 '13 at 07:40IntegerPart(discussed in my question), but that did not help. How can I fix this issue? – diracdeltafunk Jun 26 '13 at 07:40Dynamicoutside ofPlot, but you need to understand what is going on here or you're in for a lot of headache. Try this:DynamicModule[{its = 1}, Column[{Dynamic@Plot[Nest[Cos, x, its], {x, 0, 2 \[Pi]}], Slider[Dynamic[its], {1, 80, 1}]}]]– Mr.Wizard Jun 26 '13 at 07:42