Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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!

share|improve this question
    
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. –  Michael E2 Oct 20 '13 at 3:28
    
@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! –  martin Oct 20 '13 at 9:04
    
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 –  Michael E2 Oct 20 '13 at 15:29

1 Answer 1

up vote 2 down vote accepted

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]
share|improve this answer
    
@ Timothy Wofford, Thank you again - no more questions for a while - much studying of your code to keep me busy! :-) –  martin Oct 20 '13 at 12:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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