0
$\begingroup$

I want to animate a Point moving on an ellipse, but the angle I need to use is a numerical solution from an epression. How can I get mathematica to just take the value from the animated nummerical solution and use it as a variable for my pointfunction? This is my Code and this way it does not work. I think I have to remove the Set-Brackets around my Value for Psi.

ρ = 1; ε := 0.8 ; T := 10 π curvE = ParametricPlot[{ρ/(1 - ε^2) Cos[ψ], ρ/Sqrt[1 - ε^2] Sin[ψ]}, {ψ, 0, 2 π}] Animate[FindRoot[{ψ - ε Sin[ψ] == 2 π t/T} /. ε -> 0.8 /. T -> 10 π, {ψ, 0}], {t, 0, 10 π}] Animate[Show[curvE, Graphics[{PointSize[Large], Red, Point[ Dynamic[{ρ/(1 - ε^2) Cos[FindRoot[{ψ - ε Sin[ψ] == 2 π t/T}, {ψ, 0}]], ρ/Sqrt[1 - ε^2] Sin[FindRoot[{ψ - ε Sin[ψ] == 2 π t/T}, {ψ, 0}]]}]]}]], {t, 0, 10 π, AppearanceElements -> None}] 

I would appreciate your help.

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$ Commented Jan 20, 2018 at 17:52

2 Answers 2

1
$\begingroup$
FindRoot[t, {t, 0}] 

Returns {t -> 0.}. You need to extract the numeric value, e.g.

t /. FindRoot[t, {t, 0}] 

which returns 0.. Inserting the needed ψ /. in your code makes it work:

Animate[Show[curvE, Graphics[{PointSize[Large], Red, Point[Dynamic[{ρ/(1 - ε^2) Cos[#], ρ/Sqrt[1 - ε^2] Sin[#]}]] &[ ψ /. FindRoot[{ψ - ε Sin[ψ] == 2 π t/T}, {ψ, 0}]]}]], {t, 0, 10 π, AppearanceElements -> None}] 
$\endgroup$
1
  • $\begingroup$ Thank you so much, I am really fascinated by mathematica, but iam still not very good at programming. This will help me a lot! $\endgroup$ Commented Jan 20, 2018 at 15:17
0
$\begingroup$
ρ = 1; ε = 4/5; T = 10 π; curvE = ParametricPlot[{ρ/(1 - ε^2) Cos[ψ], ρ/Sqrt[1 - ε^2] Sin[ψ]}, {ψ, 0, 2 π}]; sol[t_?NumericQ] := FindRoot[{ψ - ε Sin[ψ] == 2 π t/T}, {ψ, 0}] Animate[ Show[ curvE, Graphics[{PointSize[Large], Red, Point[{ρ/(1 - ε^2) Cos[ψ], ρ/Sqrt[1 - ε^2] Sin[ψ]}]} /. sol[t]]], {t, 0, 10 π, AppearanceElements -> None}] 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.