The energy method was developed to deal with one-dimensional problems, but it can be extended to deal with two-dimensional problems where angular momentum is conserved. Motion in a central force field, dealt with previously by the Feynman algorithm, is a good example. The integral to be evaluated is derived from the equation for energy conservation in a manner similar to that used in one dimension:
![]()
If the velocity in the theta direction is written in terms of the angular momentum l, the kinetic energy associated with motion in the theta direction becomes the function of r known as the centrifugal potential. It can be combined with the potential energy into a function known as the effective potential energy, and the equation for r-motion takes the familiar one-dimensional form:
![]()
![]()
The example applies the energy method to the same power-law force problem dealt with by Newton's Law in Central-Force Orbits. The orbiting particle starts out with its velocity perpendicular to the radius vector from the force center. Such a point is known as an apside, and the first task undertaken in the program is the finding of the second apside (if one exists). The initial velocity in all cases is less than the velocity required for a circular orbit, so the second apside is closer to the force centre, and is known as the pericentre. The program uses a bisection algorithm to locate it. The inverse first power force has a logarithmic potential that goes to infinity both limits, so we set it to zero at the starting point.
The apsidal distances are then shown on an energy diagram. The potential energy is plotted in cyan, the centrifugal potential is plotted in green, and the two are added to give the effective potential energy plotted in blue. The intersections of the effective potential energy with the total energy (in red) determine the apsidal distances. (The apsidal distances are shown as red circles in the orbit plot).
Next, the region between the apsides is divided into 10,000 intervals, and the integration is carried out as in the one-dimensional case. Values are stored for subsequent plotting of the orbit, and the apsidal angle (the value of theta at the pericenter) is printed. The reason that the inverse first power force appears to have a closed orbit is because its apsidal angle is close to 11/32 of 360 degrees (the initial velocity was chosen to make this true).
The results duplicate what was found by Newton's Law, but the calculations are quite different. The n = -3 spiral orbit has trouble getting started even with a very fine r interval (you can see two linear segments at the start). The n = 0 and -1 orbits show a related effect in Liberty Basic (which runs more slowly than Java): the orbit is traced out quickly in regions where r is changing slowly.