Re: Manipulate and ParametricPlot Control?
- To: mathgroup at smc.vnet.net
- Subject: [mg114385] Re: Manipulate and ParametricPlot Control?
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Thu, 2 Dec 2010 05:43:29 -0500 (EST)
- References: <id4sf3$cbg$1@smc.vnet.net>
Hi,
>
> As a simple test file, I created a notebook (which I don't have any
> more) containing the one cell
>
> Manipulate[ Plot[x^a, {x,0,1}], {a,0,5}]
>
> (May have had a PlotRange option also; don't recall for sure.)
>
> Executed it; worked as expected.
>
> Decided to set an initial value for a; as best I recall (details are
> fuzzy), I edited the cell to change {a,0,5} to {{a,1},0,5} (that's what
> I intended to do, anyway).
>
> When I re-executed the cell, I got a live Manipulate that displayed a
> ***two-dimensional*** (2D) Control -- something I had never seen before,
> but which looked exactly like the one I more recently found in the
> ParametricPlot example in the Manipulate Help.
>
> Exercising this Manipulate displayed **two** x^a curves, with values
> corresponding to the H and V axes of the 2D Control. Functioned fine;
> no error msgs at any time.
>
> I made a (presumably erroneous) guess that the edited cell must have
> somehow been influenced by the earlier execution of the initial,
> un-edited version of the same cell (I had two implementations of the "a"
> variable floating around, maybe??). So, I tried adding Removes before
> the cell; tried Saving it, Quiting Mathematica, and re-opening it. The 2D
> Control obstinately remained (and worked). This then led to the
> re-virginating query.
from the documentation:
"Manipulate is a scoping construct that implements lexical scoping."
So the two a will (should) not interact. I have never seen a case that
would suggest that the scoping would break.
> I may have made a typo in the editing I noted above, but I sure as hell
> did NOT change Plot to ParametricPlot. And when I try some tests now
> using Plot[ {f1, f2}, ...] inside a Manipulate, I get two curves -- but
> never a 2D Control.
>
> Any ideas what went wrong here?
My guess is that you erroneously entered this:
Manipulate[Plot[x^a, {x, 0, 1}], {a, {0, 1}, 5}]
the x^a will then evaluate to {x^a[[1]],x^a[[2]} and thus two lines are
plotted. From the fact that the lines have the same color you can also
guess that Plot recognizes x^a as two lines only after evaluating the
first argument.
hth,
albert