Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. comet[eccentricity_]:=Module[{e = eccentricity},
  2. velocity = NDSolve[{v'[t]*Power[1+e, 2]/Power[1+Cos[v[t]]*e, 2] == 1, v[0]==0},
  3. v, {1, -1000, 1000}][[1, 1, 2]];
  4.  
  5. y[tt_, ec_]:=(1+ec)*Cos[velocity[tt]]/(1+ec*Cos[velocity[tt]]);
  6.  
  7. y[tt_, ec_]:=(1+ec)*Sin[velocity[tt]]/(1+ec*Cos[velocity[tt]]);
  8.  
  9. Animate[Graphics[{{Yellow, Disk[{0,0}, 0.4]}, PointSize[0.005],
  10. Point@Table[{x[tt, e],y[tt,e]},{tt, -t, t, 1}]}, Axes->True,
  11. PlotRange->{{-20, 1.5},{-10,10}}, ImageSize->{500, 350}], {t, 1, 100}]]
  12. comet[0.5]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement