MathGroup Archive 2009

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

Search the Archive

Re: Manipulate subtleties?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101402] Re: [mg101318] Manipulate subtleties?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sun, 5 Jul 2009 04:47:14 -0400 (EDT)
  • References: <7097501.1246448145332.JavaMail.root@n11>

Why not?

circlegraphics[r_] := 
 Graphics[{Circle[{0, 0}, 1], Circle[{0, 0}, r]}, PlotRange -> 2.2, 
  ImageSize -> 2*72]

Manipulate[
 circlegraphics[r],
 {{r, 0.5}, 0, 2, Appearance -> "Labeled"}]

Although I guess there is nothing that says you have to do it, it always
seems good practice to me to define functions with arguments so they
actually do have arguments.

In an Animation or Manipulate statement, graphics should have a defined fix
PlotRange, else it might be changing from frame to frame, and with your
example no outward indication of it.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  




From: AES [mailto:siegman at stanford.edu] 

If I type in (as three separate cells)

   makeFig := Graphics[{ Circle[{0,0}, 1], Circle[{0,0}, r]}];

   Manipulate[
   g1 = makeFig; 
   Show[g1, ImageSize->1*72],
   {{r, 0.5}, 0,2}]

   Manipulate[
   r = rc;  (* rc short for "control variable" *)
   g1 = makeFig;
   Show[g1, ImageSize->1*72],
   {{rc, 0.5}, 0,2}]

the second and third cells both produce Manipulate-type
output cells that appear to be OK.

The slider in the second cell output isn't active: Moving it 
doesn't cause anything to happen

The slider in the third cell animates *both* cells.

Reversing the order of the second and third cells gives 
the same behavior.

Intriguing!  

If I change g1 to g2 in the third line, the second cell gives
a Manipulate output cell with an error msg: "Radius r should be a 
positive number or pair of positive numbers, or a Scaled or Offset form."

If I remove the initial values for the slider from both lines, the 
second line still gives an error but the third doesn't, apparently using 
0 as the default value for rc (or does it use the 2nd value in {rc,0,1}?)

Seems like the second line might have done the same for r?

I guess my working rule from now on will be:

   "The control variable(s) of Manipulate slider(s) MUST 
    appear explicitly in the body of a Manipulate definition."

[But note that this is not logically necessary:  Any intelligent human, 
presented with either the second or the third cell would have all the 
information needed to do what's desired.]

Meta-question:  _Where_ in the user documentation would the mythical 
"ordinary user" have been expected to learn that the second line 
wouldn't work?




  • Prev by Date: Re: LogLinearPlot strange "features"
  • Next by Date: Re: Re: Union slowdown when SameTest is
  • Previous by thread: Manipulate subtleties?
  • Next by thread: Re: Re: Is Orange translucent? - What Methods exist?