Newton's Law and the Feynman Algorithm

1. The Euler and Feynman Algorithms: a Mass on a Spring

Newton's second law tells us how to calculate the acceleration of a body once we know the forces acting on it. The forces are either contact forces exerted by things which touch the body, or field forces due to the presence of nearby massive or charged objects. The forces may vary as the body moves, but, provided we can write explicit expressions for how the forces vary with time, position, and velocity, we can determine the acceleration of the body at every point during its motion, and we say that we know the dynamics of the motion. In order to describe the kinematics of the motion we need expressions for where the particle is and how fast it is moving at any time. For a body that is initially at rest and moves with constant acceleration, the kinematic equations take the familiar form

v = a t     (1)

x = v t / 2 = (a t) t / 2     (2).

Equations of this type provide a very compact description of the motion, and all we need do to locate the body and find how fast it is going at any time is simply to substitute the appropriate time into the kinematic equations. There are many problems (most 'real' problems) for which it is not possible to write kinematic equations to describe the motion, and we must use a different approach. (A particle sliding in a hemispherical bowl with friction is one such problem.)

The numerical approach to kinematics replaces Eqns. 1 and 2 with a table of values of time, position, and velocity. The table is more cumbersome than a set of equations, but it can describe any system for which the dynamical equations are known. The table consists of values of position and velocity at specified time intervals, and accuracy of the tabled values depends on the approximations involved in their calculation. The basic equations used to generate the table are

a = dv / dt     (3)

v = dx / dt    (4).

There is no approximation in Eqns. 3 and 4 if a and v are the average values of the acceleration and velocity - the equations are, in fact, the defining equations for average acceleration and velocity. The equations are used in numerical calculations in the form

dv = a dt     (5)

dx = v dt     (6),

and the approximation comes in when we decide what to use for the average acceleration and velocity.

In the Euler algorithm, the average velocity and acceleration are replaced by the velocity and acceleration at the beginning of the interval

v(t+dt) = v(t) + a(t) dt     (7)

x(t+dt) = x(t) + v(t) dt     (8).

The values at the beginning of the interval are known, and although they are not the best approximation for the average values, they are not bad if the time interval is short enough.

The Feynman algorithm approximates the average acceleration and velocity over a time interval by their values at the midpoint (in time). If the acceleration is constant, velocity increases linearly with time and the approximation is exact. An algorithm that is exact when the acceleration is constant will be a good approximation when the acceleration varies slowly (as it does in mechanics problems that do not involve impulsive forces). The equations on which the Feynman algorithm are based can be written

x(t+dt) = x(t) + v(t+dt/2) dt     (9)

v(t+dt/2) = v(t-dt/2) + a(t) dt     (10).

Changes in position are calculated using a velocity value that is half a step ahead in time. Likewise changes in velocity are calculated using an acceleration which is half a step ahead in time. Position and acceleration are therefore 'in phase' that is, they are calculated at the same points in time, and velocity is out of phase with both position and acceleration. The Feynman algorithm owes its simplicity to the fact that stepping the velocity half a step out of phase with the position and acceleration provides midpoint values for both Eqns. 9 and 10.

In order to start the Feynman algorithm, we must first step the velocity forward half a step in time. To do this we can use the acceleration at the beginning of the interval in the same way that we did in the Euler algorithm. Any error introduced by doing this will be of second order, and will have little effect on the overall accuracy of the calculation. Provided there are no velocity-dependent forces, the algorithm is no more complicated than the Euler algorithm, and is executed just as quickly by the computer. If there are velocity-dependent forces, we run into a problem when we try to calculate the acceleration because we do not have an in-phase value for the velocity. We will limit our discussion in this section to the case where the acceleration depends only on time and position, and deal with velocity dependence later.We will illustrate the use of the Euler and Feynman algorithms by using them to follow the motion of a mass on a spring. Consider a mass of 2 kgattached to a spring with a force-constant of 8 N/m. It is passing through its equilibrium position at a velocity of 2.8 m/s at time zero, and we want to follow its motion for one second. The first program tabulates the values obtained using the two algorithms with a time step of 0.2 seconds.

The Feynman program differs from the Euler program in only two respects: (i) after the initial conditions are defined, the velocity is stepped forward by half a time interval, and (ii) in the loop, the acceleration is calculated after the position and before the velocity. The table entries show the sequence in which the calculation is carried out. Note that, in this example, the initial half step does not affect the velocity because the acceleration is zero.

The tables help us to understand the steps in the calculation. The Feynman algorithm tells us how to fill in the displacement and velocity columns, and Newton's law tells us how to fill in the acceleration column. A plot is more useful for comparing the tabulated values with the expression determined by analytic methods.

The plot shows that the Feynman algorithm gives surprisingly accurate results even with a coarse time interval. A more thorough test of the algorithm's accuracy is provided by the following example: "A spring of force-constant k = 200 N/m hangs vertically. A 2-kg mass is attached to the unstretched spring, and is released from rest. Use the Feynman algorithm to find the maximum distance the mass falls, the time it takes to return, and the point to which it returns." A program that solves this problem using a 0.005 s time interval and plots a graph of the motion is given below:

Note that the program applies a 'correction' to the calculated time. When we use the algorithm to find when something happens, we would like to know how the accuracy of our answer compares to the time step we are using. We can ignore this question when we are not interested in an answer more accurate than the nearest time step, but we cannot ignore it when we are testing the accuracy of an algorithm. In the example, we are trying to find the point where the velocity goes to zero, but we can only test for a change in sign. When we detect a change in sign, we conclude that the velocity passed through zero tc = v/a seconds earlier. We correct the time value using this expression (and the Feynman half-step). We make no corresponding correction to the displacement because, in this example, the displacement is being determined at the turning points where the velocity passes through zero. Note that the time value is accurate to 1 % of a time step, and that errors in the displacement values begin in the fifth decimal place.