**Overview:**
This applet provides simulations for the N-body problem in which N masses
are allowed to interact gravitationally. The motions are computed using
Euler's method.

**Lagrange Points (L1-L5):**
A simulation of up to 7 gravitational masses: the sun, the earth,
and 5 satelites located at the Lagrange points (L4, L5, L1, L2, and L3).
There are two versions. In one,
the earth is given a mass equal to one-half that of the
sun. The satelites have no mass.
In this case, all lagrange points are unstable.
It is interesting to run the simulation and watch the instability
creep in.
The second case
**L1-L5 M/m=40** is the same except that the sun's mass
is 40 times the earth's. In this case,
points L4 and L5 are stable whereas L1, L2, and L3 are
unstable.

**Periodic Orbits:**
There are several examples of periodic orbits
(**Lagrange3**,
**Lagrange20**,
**FigureEight3**,
**FigureEight5**,
**FigureEight21**,
**Trefoil4**,
**Trefoil5**,
**Braid4**, etc.).
These orbits were all computed/discovered by minimizing an action functional
over curves that are represented by trigonometric polynomials (to provide the
required periodicity).
The details of how this is done are described in
Bill Casselman's
e-publication.
The optimization problems
were formulated in
AMPL
and solved with
LOQO. Click
here to see the AMPL model.

The simulations labeled "LagrangeN" consist of N identical masses distributed uniformly around a circle and given appropriate initial velocities tangent to the circle. These periodic orbits are stable for two masses but unstable for three or more.

The "FigureEight"s consist of several identical masses distributed appropriately around a figure eight (which is similar to but not exactly a Lemniscate). The three-body instance is stable but the others are not.

"TrefoilN" consists of N identical masses wandering around an orbit that resembles a flower with N-1 petals. These orbits are unstable.

"Braid4" consists of 4 identical masses wandering around a figure similar to a figure eight but with two twists instead of one.

**A New Stable Periodic 3-Body Orbit**
Vanderbei3 is a new stable orbit involving 3 bodies of equal mass.
It was found by minimizing the action functional as described above
but without the assumption that each mass follows the same path with
only a phase delay.

Other simulations include **Pinwheel**, **BigBang**,
and **Random**. In these, any number of masses can be specified.
They all have mass equal to that of the earth.

It appears to be very difficult, perhaps impossible, to find stable
periodic solutions to the n-body problem for n>3.

Here are my best attempts for n=4.

**Controlling the Simulation:**

**dt**is the time increment in years (so 0.003 is approximately one day). Give a negative value for dt to run the simulation backwards.**Warp:**The most time consuming part of the simulation is painting the window. Parameter "warp" indicates how many simulation time steps are performed per repainting. Large warp factors make the simulation run very fast.- You can
**Pause**the simulation, change**dt**and/or**warp**and then press**Apply**or**Play**to restart the simulation using these new animation parameters.