Practice question · Multiple choice
A simulation of the solar system using Euler's method shows the Earth spiralling into the Sun over a few thousand orbits. Is that a bug?
Hints
- Ask whether the error is random or biased in one direction.
- Shrinking the timestep slows the spiral. Does it ever stop it?
Show the answer
A. Not a coding bug but a method one: Euler does not conserve energy
Why
Euler leaks energy systematically, so the error is a drift rather than noise and a smaller timestep only postpones the spiral. Symplectic integrators are built to conserve the relevant quantity exactly, which is why orbital mechanics uses them and why 'reduce h' is the wrong instinct here.
Practise Simulation and Monte Carlo Methods
The app has 6 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.