Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: LocatorAutoCreate in 2-parameter Manipulate?
Replies: 0

 Murray Eisenberg Posts: 16 Registered: 4/14/10
LocatorAutoCreate in 2-parameter Manipulate?
Posted: Apr 16, 2010 5:51 AM

The following code works to plot, for a simple harmonic oscillator, the
phase plane trajectory through the point where you move the Locator:

soln[t_, x0_, v0_] := {x0 Cos[t] + v0 Sin[t], v0 Cos[t] - x0 Sin[t]}

Manipulate[{x0, v0} = u;
ParametricPlot[soln[t, x0, v0], {t, 0, 4 \[Pi]},
PlotRange -> {{-4, 4}, {-4, 4}}, PlotStyle -> Thick],
{u, {-3.5, -3.5}, {3.5, 3.5}},
ControlType -> Locator]

I now want to be able to create (and destroy) locators there. So I
tried option LocatorAutoCreate:

Manipulate[{x0, v0} = u;
ParametricPlot[soln[t, x0, v0], {t, 0, 4 \[Pi]},
PlotRange -> {{-4, 4}, {-4, 4}}, PlotStyle -> Thick],
{{u, {-3.5, -3.5}, {3.5, 3.5}},
Locator, LocatorAutoCreate -> True}]

But this does not work: I still get only one locator and corresponding
one curve shown after Alt-Click somewhere.

[Note that changing the manipulate parameter specification to the form
shown on page ref/LocatorAutoCreate...

{{u, {{-3.5, -3.5}, {3.5, 3.5}}}, Locator, LocatorAutoCreate -> True}

... gives completely spurious results.]

Is it possible to fix this and yet still do it within a Manipulate. For
good reasons I do NOT want to totally "roll my own" using DynamicModule,
etc.

--
Murray Eisenberg murrayeisenberg@gmail.com
80 Fearing Street phone 413 549-1020 (H)
Amherst, MA 01002-1912