Physics Simulations
Three-Body Problem
Integrate Newtonian gravity, explore orbital trails and inspect conservation laws.
three_body() integrates Newtonian gravity for three masses. The default call is one preset. The other forms on this page choose a figure-eight orbit, a chaotic orbit, a solar-system-like arrangement, or explicit masses.
The trails show where each body has been. A figure-eight is a special periodic solution. The chaotic preset separates quickly if you change a mass. The integrator is numerical, so a long trail is an approximation of the differential equation.
Equation
three_body()
What the simulation is integrating
Physics examples are simulations with a fixed mathematical model. Generate Graph starts the scene and its controls. It does not fit a curve through measured data. Sliders and presets change initial conditions or parameters that the integrator already understands.
Read the conserved quantities and the trails, not only the moving shape. A chaotic system can look smooth for a short time and then diverge. A small change in the input, such as a count or a separation, is part of the example rather than a different kind of physics.
Reading the input
three_body()— This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
Other versions of this example
These stay on this page so each version keeps the same explanation. Choose Try example to run a version in its Studio workflow, or copy it into the editable field below.
three_body()
This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
three_body()
three_body(preset="figure8")
This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
three_body(preset="figure8")
three_body(preset="chaotic")
This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
three_body(preset="chaotic")
three_body(preset="solar")
This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
three_body(preset="solar")
three_body(1,2,3)
This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
three_body(1,2,3)
Try a change
- Edit one number in the field, then use Generate Graph. The studio opens on the homepage with the edited text and runs it.
- Use Open in DGS Studio when you want the expression loaded but not run yet.
Generate Graph starts the simulation that this command names. Playback controls belong to that scene. The expression does not become a static y = f(x) plot.