Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

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

Advanced Search

Back to Topic List Back to Topic List  
Murray Eisenberg

Posts: 16
Registered: 4/14/10
LocatorAutoCreate in 2-parameter Manipulate?
Posted: Apr 16, 2010 5:51 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.