2. Time-Dependent Forces: the Driven Oscillator

The Feynman algorithm needs no modification to deal with forces that depend on time as well as position. Consider the example of a mass that is attached to a spring and is subjected to a driving force that varies sinusoidally at the natural frequency of oscillation of the mass-spring system. The analytic solution of this problem is beyond the level of introductory physics texts, but the numerical solution requires only direct application of the Feynman algorithm. The parameters of the problem are given in the program listings, and the output is a plot of the driving force and the response of the mass. (The mass is at rest at its equilibrium position when the force is turned on.)

The response appears to increase linearly with time, and to lag the force by 90 degrees. (This information enables us to guess a particular integral and proceed with a standard analytic solution if we wish.)