1
|
5684 Views
|
6 Replies
|
4 Total Likes
View groups...
Share

# Animate a point on a function?

Posted 8 years ago
 Hi, The code below don't work! f[x_] := x^2 + 2 x - 3 p = {{a, f[a]}} Animate[ Plot[f[x], {x, -2, 4}, Epilog -> Point[p]], {a, -2, 4}]  But, If I replace the variable p with is evaluation, the code is OK. Animate[Plot[f[x], {x, -2, 4}, Epilog -> Point[{{a, -3 + 2 a + a^2}}]], {a, -2, 4}]  I want to use the variable in my document. How can I do it? Thank you. Marcel Pelletier
6 Replies
Sort By:
Posted 8 years ago
 Hi, Marcel, I posted this new code for the tangent line as a suggestion for you to post other pieces of code that you are using in the course. They may be useful for others in the Wolfram Community and the Community may suggest new solutions and useful pieces of code. Sure, it's your decision...
Posted 8 years ago
 Hi Valeriu, Thank you for this new response! I have create animations for my course.. Your help are welcome. Marcel Pelletier
Posted 8 years ago
 f[x_] := 2 x^3 + 2 x - 3 p[a_] := {{a, f[a]}} t[x_, a_] := f[a] + (x - a) f'[a] Animate[Plot[f[x], {x, -2, 4}, PlotRange -> {{-2, 4}, {-24, 128}}, Epilog -> {PointSize[Medium], Point[p[a]], Red, InfiniteLine[{p[a][[1]], {0, t[0, a]}}]}], {a, -2, 4}, AnimationDirection -> ForwardBackward] 
Posted 8 years ago
 You are welcome!
Posted 8 years ago
 Hi Valeriu.Thank you for your help. This will ameliorate my document.Marcel Pelletier
Posted 8 years ago
 f[x_] := x^2 + 2 x - 3 p[a_] := {{a, f[a]}} Animate[Plot[f[x], {x, -2, 4}, Epilog -> Point[p[a]]], {a, -2, 4}]