DGS Studio

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

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

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.

Edit and generate

Generate Graph opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples