Simulation of Newtonian gravitation for a two-body system. The simulation panel is a visualisation of the motion of the two bodies, the larger one (red) of variable mass M and the smaller one (blue) of fixed mass m. There are three (plus one) graphs:
In the velocity-time graph, the blue/black lines are the radial/tangential velocities of the smaller (blue) mass m. These are calculated as the simulation is running. Cartesian components of the velocity can also be shown as dashed lines.
In the energy-time graph, the red line is the kinetic energy of the larger (red) mass M, while the blue line is the kinetic energy of the smaller (blue) mass m. The black line is the gravitational potential energy of their interaction, while the dashed line is the total energy (if shown). These are calculated as the simulation is running.
In the energy-position graphs, the analytic form for the effective radial potential energy is shown, as a function of the radial separation between the two masses, which is based on analysing the relative motion as a one-body problem. Exact expressions are used for the angular momentum of the system, which provides a "centrifugal" term to the effective radial potential energy. The total energy is shown as a dashed line. In the dynamic visualisation, the radial potential energy is calculated and traced when the simulation is running. In the static visualisation, the vertical scale is larger to show how U_{eff} = GPE + L^2 term. The orbital eccentricity is also displayed as a text overlay.
The simulation automatically sets the initial conditions (position, velocity) for the larger (red) mass such that the centre of mass (white) is stationary at the centre of the simulation panel.