1
$\begingroup$

I want to draw an arrow in a diagram which starts from a point, say, $(x,\,\sqrt{x^2+2})$ and ends up at a point, say, $(x',\,\sin{x^2})$.

I want to manipulate or animate such an arrow. For example, I want to animate how the arrow starting from a point proceeds to the end point. But I don't know how!

Any idea would be appreciated!

$\endgroup$
4
  • $\begingroup$ Press F1, lookup Graphics, Arrow, Manipulate. $\endgroup$
    – Kuba
    Oct 19, 2017 at 21:29
  • $\begingroup$ @Kuba Didn't help. $\endgroup$
    – Immanuel
    Oct 19, 2017 at 21:36
  • $\begingroup$ At both stages! I cannot draw an arrow which I can manipulate or animate it. $\endgroup$
    – Immanuel
    Oct 19, 2017 at 21:39
  • $\begingroup$ @Kuba I edited the OP. $\endgroup$
    – Immanuel
    Oct 19, 2017 at 21:45

1 Answer 1

4
$\begingroup$

But how can I animate the growing of the arrow starting from a point and ending up at another point?

Per comment. This version supports different x for each function.

enter image description here

Manipulate[

 Plot[{g, f}, {x, -10, 10}, PlotLegends -> {"f(x)", "g(x)"}, 
  PlotRange -> {{-5, 5}, {-5, 5}},
  Epilog -> {Arrow[{{xfValue, f /. x -> xfValue}, {xgValue, 
             g /. x -> xgValue}}]}
 ],

 Grid[{
   {Control[{{f, Sqrt[x^2 + 2]}, InputField}]},
   {Control[{{g, Sin[x^2]}, InputField}]}}
 ],

 {{xfValue, 1, "x for f"}, -10, 10, .1, Appearance -> "Labeled"},
 {{xgValue, 4.1, "x for g"}, -10, 10, .1, Appearance -> "Labeled"}
 ]
$\endgroup$
2
  • $\begingroup$ Nice! But how can I animate the growing of the arrow starting from a point and ending up at another point? $\endgroup$
    – Immanuel
    Oct 20, 2017 at 10:47
  • $\begingroup$ @Immanuel updated new version. Removed old versions as not needed any more. $\endgroup$
    – Nasser
    Oct 20, 2017 at 13:36

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.