You will move a planet round the Sun in small time steps and check that its energy and angular momentum stay the same. Distances are in AU, speeds in km/s, time in seconds; . One AU is .
The idea. The acceleration points at the Sun: . The leapfrog method takes a half step in velocity, a full step in position, and another half step in velocity. It keeps the energy steady over many orbits.
Your tasks.
acceleration, return the two parts of the acceleration, in km/s per second, at the point (x, y) in AU.step, carry out one leapfrog step of length dt seconds.energy, return the energy per kilogram, , in .Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…