2
$\begingroup$

Update 1

@ Michael E2, my effort - for what it is worth!:

f[x_] := Im[(-1)^(-1 - x/2) 2^(1 - x) \[Pi]^-x x! Zeta[x]];
f[a_] := -a Zeta[1 - a];
Manipulate[With[{{x0 = Clip[p[[1]], {3, 10}]}, {a0 = Clip[p[[1]], {3, 10}]}},
Plot[{f[x], f[a]}, {x, 3, 10}, ImagePadding -> 20, LabelStyle -> (FontFamily -> 
"Ariel"), Epilog -> {PointSize[Large], Red, Tooltip[Point[#], #] &@{x0, f[x0], a0, 
f[a0]}}]], {{p, {3, 0}}, Locator, Appearance -> None}, AppearanceElements -> None]

Original question

I would like to control two locators at once (both moving with same x value), outputting 2 sets of coordinates simultaneously. The plot I am working looks like this:

enter image description here

generated by the following code:

Plot[{Im[(
N[Zeta[x]] x!)/(\[Pi]^x (2^(x - 1) (-1)^(x/2 + 1)))], 
-x Zeta[1 - x]}, {x, 3, 10}, Epilog -> {PointSize[Medium], Red, 
Point[{{5, -5 Zeta[1 - 5]}, 
{5, Im[(N[Zeta[5]] 5!)/(\[Pi]^5 (2^(5 - 1) (-1)^(5/2 + 1)))]}}]}]

Michael E2 and Timothy Wofford provided a code that controls one locator in this post. I would like to achieve the same thing with multiple locators (ideally by moving one locator with cursor & both locators moving with equal x values at the same time - both generating their separate coordinates).

If possible also, I would like the manipulate cell to output the value of a function of each point as it moves, along with the sum of both functions. I hope I am making sense here!

$\endgroup$
3
  • $\begingroup$ You can do this with just one locator, using its x coordinate and applying each function to get the y coordinates for the two red points. The locator would be coded just as in answers to your other question. $\endgroup$
    – Michael E2
    Oct 20, 2013 at 3:28
  • $\begingroup$ @Michael E2, Sorry, I am completely lost - I really have no clue where to start plotting two functions - I have included my effort in the update above - as you can see, I am not getting very far! $\endgroup$
    – martin
    Oct 20, 2013 at 9:04
  • $\begingroup$ No problem. I just didn't have time to write up and check an answer. But I thought I could just give a quick hint and you might figure it out for yourself -- always better if you can. :) Anyway, it's answered now. :D $\endgroup$
    – Michael E2
    Oct 20, 2013 at 15:29

1 Answer 1

2
$\begingroup$

Please compare this to your attempt and try to understand the slight changes I made.

f[x_] := Im[(-1)^(-1 - x/2) 2^(1 - x) \[Pi]^-x x! Zeta[x]];
g[a_] := -a Zeta[1 - a];
Manipulate[
 With[{x0 = Clip[p[[1]], {1., 10. (*or Infinity*)}]}, 
  Plot[{f[x], g[x]}, {x, 0, 10}, 
   Epilog -> {PointSize[Large], 
     Blue,Tooltip[Point[#], #] &@{x0, f[x0]},
     Red, Tooltip[Point[#], #] &@{x0, g[x0]}
 }, PlotLabel -> {x0, f[x0]}]], {{p, {4, 0}}, Locator, 
Appearance -> None}, AppearanceElements -> None]
$\endgroup$
1
  • $\begingroup$ @ Timothy Wofford, Thank you again - no more questions for a while - much studying of your code to keep me busy! :-) $\endgroup$
    – martin
    Oct 20, 2013 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.