### Gravivational And Electrostatic Fields

Newton's law of universal gravitation enables us to calculate the field set up by an array of point masses (or uniform spheres). We can do this wherever we wish in the vicinity of the mass array, and this enables us to plot fieldlines, continuous curves tangent to the field, and equipotentials, continuous curves perpendicular to the field, at every point along their length. For a single point mass, a fieldline is a straight line extending in from infinity and terminating at the point mass. Equipotentials are circles centred on the point mass. A small particle released from rest at a point on the fieldline will move along it, accelerating until it collides with the point mass. (For curved fieldlines, the acceleration of the particle, not the velocity, is tangent to the fieldline). In terms of potential, the particle falls down into a potential well gaining kinetic energy as it goes.

Electrostatic fields are much stronger than gravitational fields, and the force can be repulsive (for like charges) or attractive (for unlike charges). Arrays of charges usually are neutral, with fieldlines starting on positive changes and terminating on negative charges. The electrostatic potential is positive and increasing as one approaches a positive charge, and negative and decreasing as one approaches a negative charge.

Both fields obey an inverse-square law, so only one routine (Lplot) is needed. The two examples in the program have uniform spheres at the vertices of an equilateral triangle. In the gravitational case the masses of the spheres are identical. In the electrostatic case, the charge of the positive sphere is twice the magnitude of the charge of the two negative spheres. In the gravitational case, the fieldlines could be started around the perimeter of the plot, but it is easier to start them uniformly spaced around the spheres and plot them in the reverse direction. In the electrostatic case, the fieldlines start at the positive charge, and are expected to terminate on the negative charges. To get an accurate plot, the algorithm uses a Feynman half-step look ahead when calculating the field direction. It is not easy to see if a fieldline is drawn accurately, but an inaccurate equipotential shows up clearly because it fails to close (equipotentials are drawn perpendicular to the field using the fact that the product of the slopes of perpendicular curves is -1). Another type of plot can be generated by calculating the gravitational potential at each pixel in the field of view, and using it to set the pixel's colour (Cplot). Equipotentials are not 'drawn' - they appear as the boundaries between regions of different colour. The computational aspect of the program that generates this type of plot is very simple. The only decision that needs to be made concerns the width of the potential region to be plotted as a single colour. The program uses six colours and linear scaling, i.e. the potential changes by the same amount across each colour band. Note that symmetry constrains the gravitational fieldlines to intersect at the centre of the equilateral triangle. The field is zero at the centre, and the potential is nearly constant over the entire central region. As expected, the electrostatic fieldlines all manage to find their way to a negative charge.

The central red triangle in the gravitational potential plot is an artifact of the (deliberate) choice of boundary in a region where the potential is changing very slowly. A similar choice of boundary in The Thre-Body Problem is used highlight a peak in the potential and explain the motion of the Trojan asteroid group.

### Three-Body Problem: Trojan Asteroids

The Trojan asteroids lie in Jupiter's orbit equidistant from Jupiter and the sun. They are an example of what is known as the restricted three-body problem: the motion of a small body, an asteroid, under the influence of two massive bodies whose motion is not affected by the presence of the asteroid. The gravitational forces exerted by the sun and Jupiter combine to give the asteroid a stable orbit with Jupiter's period of rotation. (Some trigonometry is needed to show that the Trojan site forms an equilateral triangle with the sun and Jupiter). In the example, the massive bodies executing circular orbits about their common centre of mass can have mass ratios ranging from 9 up to the value for sun-earth system. It is convenient to view the motion of the asteroid in a frame rotating with the massive bodies. This is a non-inertial frame, and both centrifugal and Coriolis forces appear in Newton's Law. Viewed in the rotating frame, the asteroid in a stable orbit remains at rest at the point where the net gravitational attraction balances the repulsive centrifugal force. Points with this property show up clearly on a color plot of the effective potential in the rotating frame. This potential is the sum of three negative terms: a centrifugal potential that varies as the square of the distance from the centre of mass (much like an "upside down" harmonic potential), and two gravitational wells centered on the massive bodies. Points where the effective potential falls within a specified range share a common color, and the scale factor is adjusted to place the Trojan site near a color boundary. Such plots usually use linear or logarithmic scales, but here an inverse scale is used to give suitable numbers and widths of the color bands (this produces color bands of constant width near a massive body). The plot is centred on the centre of mass of the system, with the more massive body (M) on the left and the less massive body (m) a distance d to its right. The fist two screen images show orbits starting from near a Trojan site for M/m ratios of 19 and 29.  The most prominent features of the potential plots are the red regions surrounding the Trojan sites. As the red regions are the crests of hills, it is not obvious that a Trojan orbit can be stable. As the mass ratio changes, the shape of a crest changes, but it remains a crest. It can be shown analytically that orbits for M/m greater than 25 are stable, but the calculation requires more than the trigonometry needed to find the equilateral triangle. The numerical study of stability, on the other hand, requires only the Feynman algorithm for velocity-dependent forces (such as the Coriolis force). Each plot shows the path taken by the asteroid when it is released from rest (in the rotating frame) with a y-displacement of d/400 (about 1/3 of a pixel) from the equilibrium site. This displacement puts the asteroid on the far side of the hill from the centre of mass, and initially it moves outward as we would expect. As soon as it acquires a significant velocity, the Coriolis force deflects it to the right (in a frame rotating counterclockwise). What happens then depends on the mass ratio. For low mass ratios it spirals outward. For intermediate mass ratios it traces out loops close to the Trojan site. At higher mass ratios the potential crest becomes an elongated ridge, and the orbit bumps its way around it. On 9 Nov 2002 my car radio informed me that an asteroid the size of a football field had recently been found to share the earth's orbit. In a frame rotating with the earth, it was said to have a horseshoe-shaped orbit. As I drove along, I visualized the crest I had already plotted for Jupiter turning into a ridge that circles the sun, and the asteroid bouncing along the crest in a horseshoe orbit until it turns at a low point near the earth. That evening I extended the Trojan applet to include the sun/earth mass ratio, and found the horseshoe orbit plotted here. It has a period of 160 years. 