Re: Loops in Manipulate
- To: mathgroup at smc.vnet.net
- Subject: [mg107701] Re: Loops in Manipulate
- From: dh <dh at metrohm.com>
- Date: Tue, 23 Feb 2010 08:04:55 -0500 (EST)
- References: <31633330.1266826380053.JavaMail.root@n11> <hlv61e$pp6$1@smc.vnet.net>
Hi Benson, manipulate has the following syntax: Manipulate[expression,iterator] Now consider the output of your expression: Do[Print[n], {n, 1, 3, 1}]. "Do" always returns nothing, that is "Null". The output of "Print" is a side effect and goes to the message stream. Therefore, what is shown inside Manipulate is "Null". Therefore, you need to produce sokme output to display. You could e.g. use Table: Manipulate[Table[n, {n, 1, rep}], {rep, 1, 3}] Daniel On 23.02.2010 01:03, benson sundheim wrote: > David: > > Thank you for your effort in dealing with my question. I'm afraid I > didn't make myself sufficiently clear. My purpose is to study the > rate of convergence of a statistical quantity - I intend to vary the > number of steps varying between 1000 and 100000 looking at the > behavior of the power law characterizing the resulting histograms. > Hence I would like to vary the number of steps in he loop via > Manipiulate. > > But > > Do[Print[n], {n, 1, 3, 1}] works to produce a output list and > > Manipulate[Do[Print[n], {n, 1, rep, 1}], {r, 1, 3}] produces > only a slider and Null. > > I observe that there is no error message complaining there is a flaw > in the iterator. Also note that including a specific reference to > rep, such as Print,n,rep}, has no effect. Your further comments would > be appreciated. > > Benson Sundheim > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh at metrohm.com> Internet:<http://www.metrohm.com>