Stepping the oscillator
Intermediate Methods in Theoretical Physics
Edward F. Redish
|Consider a simple harmonic oscillator (e.g., an idealized cart connected to a massless spring as shown in the figure at the right). In this problem, you will solve the equation of motion numerically as weel as analytically and explore the accuracy of your results. Assume the cart has a mass m and the spring has a spring constant k. For this problem, do not convert to dimensionless quantities.||
- Write Newton's second law for the cart on the spring as a pair of coupled ordinary differential equations for the cart's position (x) and the cart's velocity (v).
- Find the particular analytic solution to these equations for the initial conditions
x(t = 0) = x0
v(t = 0) = v0
- Create a spreadsheet to solve Newton's second law as a stepping law using Euler's method. Set it up so you have columns for t, x, v, and for KE, PE, and Total Energy. Set it up so the calculation uses the following parameters. (It's best to put the parameters somewhere in the spreadsheet and give them a name so that it is easy to vary them later.)
Create two graphs, one plotting position and velocity, the other plotting potential, kinetic, and total energies. Be sure to take enough points to do two full oscillations.
- k = 3 (N/m)
- m = 1 (kg)
- x0 = 1 (m)
- v0 = 0 (m/s)
- Δt = 0.05 (s)
- Copy your sheet onto a second page and solve the equation with the half-step method. (You will need to insert columns for the 1/2-x and 1/2-v values.
- Evaluate your numerical results, comparing them to the exact and to each other.
|University of Maryland||Physics Department||Physics 374 Home
This page prepared by
Edward F. Redish
Department of Physics
University of Maryland
College Park, MD 20742
Phone: (301) 405-6120
Last revision 14. September, 2004.