I am attempting to create a dynamic contour plot of an ellipse with two locators as the foci within a locator pane. The following code has been implemented:
a:= Sqrt[c^2 + b^2]
b = 1;
c = 0;
ellipse := (x^2)/(a^2) + (y^2)/(b^2)
plot := Dynamic[ContourPlot[ellipse == 1, {x,-2,2}, {y,-2,2}]
LocatorPane[Dynamic[{ {c,0}, {-c,0} }], plot]
When I evaluate this, the plot behaves pretty much as desired except that only one of the locators can be moved.
This is because I placed -c
inside Dynamic
as opposed to just the variable c
. Ordinarily, I would just do something like Dynamic[{-c,0}, (c = -#)&]
, however, LocatorPane
requires that I include the full list of locators within a single Dynamic
.
I want to find a way to apply a function to Dynamic
that causes the first component of the second locator to take on the value of -c
while the first locator is using c
.
Any help?