# Plot the elliptical orbit from a Lagrangian?

Posted 6 months ago
973 Views
|
2 Replies
|
1 Total Likes
|
 Can anyone help me? I want to make the orbit ellipse. Please help me to fix my code. lagrangian = 1/2 (x'[t]^2 + y'[t]^2) + 1/Sqrt[x[t]^2 + y[t]^2]; eq = Table[ D[lagrangian, x1] - D[D[lagrangian, D[x1, t]], t] == 0, {x1, {x[t], y[t]}}]; sol = NDSolve[Join[eq, {x[0] == 1, x'[0] == 0, y[0] == 0, y'[0] == 1}], {x[t], y[t]}, {t, 0, 5}]; ParametricPlot[{x[t], y[t]} /. sol[[1]], {t, 0, 5}] enter image description here
2 Replies
Sort By:
Posted 6 months ago
 your orbit is circular because your initial velocity is perpendicular to the line from the origin to the starting position.