Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
afeiguin
GitHub Repository: afeiguin/comp-phys
Path: blob/master/03_01_oscillations.ipynb
374 views
Kernel: Python 3

Oscillatory Motion

The harmonic oscillator

We know that simple oscillatory motion is described by a general quadratic potential of the form V=12kx2,V=\frac{1}{2}kx^2, where kk is a “force constant”. In a spring, this is a measure of the stiffness of the spring. In a pendulum, it is given by k=mgLk=\frac{mg}{L} where mm is the mass of the particle and LL its length. From this potential we can extract the force F=dVdx=kxF=-\frac{dV}{dx}=-kx and the equation of motion can be written as d2xdt2=ω02x,\frac{d^2x}{dt^2}=-\omega _0 ^2x, where the quantity ω0\omega _0 is defined by ω02=km\omega _0^2=\frac{k}{m} The dynamical motion described by these equations is called “simple harmonic motion” and can be solved analytically: x(t)=Acos(ω0t+δ),x(t)=A\cos{(\omega _0t+\delta)}, where aa is the amplitude of th oscillations and δ\delta is a phase that depends on the initial conditions.

We can now define a period TT such as x(t+T)=x(t).x(t+T)=x(t). Since ω0T\omega _0T corresponds to one cycle, we obtain T=2πω0=2πk/m.T=\frac{2\pi}{\omega _0}=\frac{2\pi}{\sqrt{k/m}}. The frequency ν\nu is the number of cycles per unit of time and is given by ν=1/T\nu=1/T. Note that the period of the motion depends on the ratio k/mk/m and is completely independent of the initial conditions.

Exercise 3.1: Energy conservation

  1. In Exercise 1.6 we wrote program to simulate simple harmonic motion. Now use the program to calculate the relative change in the total energy during one cycle Δn=(EnE0)/E0\Delta _n=(E_n-E_0)/E_0. Is the function Δ\Delta uniformly small during the cycle? Choose x0=1x_0=1, v0=0v_0=0, and ω02=9\omega_0^2=9 Compare using Euler’s method, 2nd. order Runge-Kutta, and Verlet's algorithm.

  2. Plot position and velocity as a function of the time tt.

  3. Compute the amplitude AA for the initial conditions x0=4x_0=4, v0=0v_0=0, and x0=0x_0=0, v0=4v_0=4; choose ω02=4\omega _0^2=4 in both cases. What quantity determines the value of AA?.

  4. Compute the average value of the kinetic energy and the potential energy during a complete cycle. Is there a relation between the two averages?

  5. Plot the path of the oscillator in phase space (x,v)(x,v). Set ω02=9\omega _0^2=9 and use different initial conditions (x0,v0)=(1,0);(0,1);(4,0)(x_0,v_0)=(1,0);(0,1);(4,0). Do you find different paths for each of them? What physical quantity distinguishes or characterizes each path? What is the shape of the phase paths? Is the motion of a representative point (x,v)(x,v) always in the clockwise or counterclockwise direction?

Challenge 3:1

Modify the code for Exercise 1.6 to solve Exercise 3.1

Exercise 3.2: Large oscillations

The pendulum responds to the equation of motion for simple harmonic motion only in the limit of small angles. In the case of large oscillations, the equation has to be modified becoming d2θdt2=gLsinθ.\frac{d^2\theta}{dt^2}=-\frac{g}{L}\sin{\theta}.

The energy of the pendulum is then given by E=12mL2(dθdt)2+mgL(1cosθ)E=\frac{1}{2}mL^2(\frac{d\theta}{dt})^2+mgL(1-\cos{\theta})

  1. Modify your program to simulate large amplitude oscillations in a pendulum. Set g/L=9g/L=9 and choose Δt\Delta t so that the numerical solution is stable, i.e. it does no diverge with time from the “true” solution. Check the stability by calculating the total energy and ensuring that it does not drift from its initial value.

  2. Set dθ/dtt=0=0d\theta /dt|_{t=0}=0 and make plots of θ(t)\theta (t) and dθ/dt(t)d\theta /dt(t) for the initial conditions θ(t=0)=0.1\theta(t=0)=0.1, 0.2, 0.4, 0.8, 1.0. Describe the qualitative behavior of θ\theta and dθ/dtd\theta /dt. What is the period TT and the maximum amplitude θmax\theta _{max} in each case? Plot TT versus θmax\theta _{max} and discuss the qualitative dependence of the period on the amplitude. How do the results compare in the linear and non-linear cases, e.g. which period is larger? Explain the relative values of TT in physical terms.

Challenge 3.2:

Modify the code and solve Exercise 3.2

Exercise 3.3: Damped oscillations

If a drag force is included in the problem, the equation of motion becomes: d2xdt2=ω02xγdxdt,\frac{d^2x}{dt^2}=-\omega _0^2x-\gamma \frac{dx}{dt}, where the “damping coefficient” gamma is a measure of the friction. Note that the drag force opposes the motion.

  1. Incorporate the effects of damping in your program and plot the time dependece of position and velocity. Make runs for ω02=9\omega _0^2=9, x0=1x_0=1, v0=0v_0=0, and γ=0.5\gamma=0.5.

  2. Compare the period and angular frequency to the undamped case. Is the period longer or shorter? Make additional runs for γ=1,2,3\gamma = 1,2,3. Does the frequency increase or decrease with greater damping?

  3. Define the amplitude as the maximum value of xx in one cycle. Compute the “relaxation time” τ\tau, the time it takes for the amplitude to change from its maximum to 1/e0.371/e\approx 0.37 of its maximum value. To do this, plot the maximum amplitud of each cycle, and fit it with an exponential of the form A0expt/τA_0 \exp{-t/\tau}. Compute τ\tau for each of the values of γ\gamma used in the previous item and discuss the qualitative dependence of τ\tau with γ\gamma.

  4. Plot the total energy as a function of time for the values of γ\gamma considered previously. If the decrease of the energy is not monotonic, explain the cause of the time-dependence.

  5. Compute the average value of the kinetic energy, potential energy, and total energy over a complete cycle. Plot these averages as a function of the number of cycles. Due to the presence of damping, these averages decrease with time. Is the decrease uniform?

  6. Compute the time-dependence of x(t)x(t) and v(t)v(t) for γ=4,5,6,7,8\gamma=4,5,6,7,8. Is the motion oscillatory for all γ\gamma? Consider a condition for equilibrium x<0.0001x<0.0001; how quickly does x(t)x(t) decay to equilibrium? For fixed ω0\omega _0, the oscillator is said to be “critically damped” at the smallest values of γ\gamma for which the decay to equilibrium is monotonic. For what value of γ\gamma does critical damping occur for ω02=9\omega_0^2=9 and ω02=4\omega^2 _0=4? For each value of ω0\omega _0 compute the value of γ\gamma for which the system approaches equilibrium more quickly.

  7. Construct the phase space diagram for cases ω02=9\omega_0 ^2=9 and γ=0.5\gamma=0.5, 2, 4, 6, 8. Area the qualitative features of the paths independent of γ\gamma? If not, discuss the qualitative differences.

Challenge 3.3:

Modify the code and solve Exercise 3.3

Exercise 3.4: Linear response to external forces

How can we determine the period of a pendulum that is not already in motion? The obvious way is to disturb the system, for instance, applying a small displacement and observe the resulting motion. We will finr that the “response” of a system is actually an intrinsic property of the system and can tell us about its nature in the absence of perturbations.

Consider a damped linear oscillator with an external force F(t)F(t) d2xdt2=ω02xγdxdt+1mF(t).\frac{d^2x}{dt^2}=-\omega _0^2x-\gamma\frac{dx}{dt}+\frac{1}{m}F(t). It is customary to interpret the reponse of the system in terms of the displacement xx. The time dependence in F(t)F(t) is arbitrary. A particular case is when the force is harmonic: 1mF(t)=A0cosωt,\frac{1}{m}F(t)=A_0 \cos{\omega t}, where ω\omega is the angular frequency of the driving force.

  1. Modify your program so that an external force of the form ([driving force]) is included. Set ω02=9\omega _0^2=9, γ=0.5\gamma=0.5, A0=1A_0=1 and ω=2\omega = 2 (we’ll use these values for the rest of the exercise). These values correspond to a lightly damped oscillator. Plot x(t)x(t) versus tt for the initial conditions (x0=1,v0=0)(x_0=1,v_0=0). How does the qualitative behavior differ from the unperturbed case? What is the period and angular frequency of x(t)x(t) after several oscillations? Obtain a similar plot with (x0=0,v0=1)(x_0=0,v_0=1). What is the period and angular frequency after several oscillations? Does x(t)x(t) approach a limiting behavior that is independent of the initial conditions? Identify a “transient” part of x(t)x(t) which depends on the initial conditions and decays in time, and a “steady state” part which dominates at longer times and which is independent of the initial conditions.

  2. Compute x(t)x(t) for ω=1\omega = 1 and ω=4\omega = 4. What is the period and angular frequency of the steady state in each case?

  3. Compute x(t)x(t) for ω0=4\omega _0=4. What is the angular frequency of the steady state motion? On the basis of these results, explain which parameters determine the frequency of the steady state behavior.

  4. Verify that the steady state behavior is given by x(t)=A(ω)cosωt+δ,x(t)=A(\omega )\cos{\omega t+\delta}, where δ\delta is the phase difference between the applied force and the steady state motion. Compute δ\delta for ω02=9,γ=0.5\omega_0^2=9,\gamma=0.5,ω=0\omega=0, 1.01.0, 2.02.0, 2.22.2, 2.42.4, 2.62.6, 2.82.8, 3.03.0, 3.23.2, 3.43.4. Repeat the computation for γ=1.5\gamma=1.5 and plot δ\delta versus ω\omega for the two values of γ\gamma. Discuss the qualitative dependence of δ(ω)\delta(\omega ) in the two cases.

Exercise 3.5: Resonance

The long term behavior of the driven harmonic oscillator depends on the frequency of the driving force. One measure of this behavior is the maximum of the steady state displacement A(ω)A(\omega ).

  1. Adopt the initial condition (x0=0,v0=0)(x_0=0,v_0=0). Compute A(ω)A(\omega ) for ω=0\omega =0, 1.01.0, 2.02.0, 2.22.2, 2.42.4, 2.62.6, 2.82.8, 3.03.0, 3.23.2, 3.43.4 with ω0=3\omega _0=3 and γ=0.5\gamma =0.5. Plot A(ω)A(\omega ) versus ω\omega and describe its qualitative behavior. If A(ω)A(\omega ) has a maximum, determine the “resonance angular frequency” ωmax\omega _{max}, which is the frequency at the maximum of AA. Is the value of ωmax\omega _{max} close to the natural angular frequency ω0\omega _0?

  2. Compute AmaxA_{max}, the value of the amplitude at ωmax\omega _{max}, and the ratio Δω/ωmax\Delta \omega /\omega _{max}, where Δω\Delta \omega is the “width” of the resonance. Define Δω\Delta \omega as the frequency interval between points on the amplitude curve which are 1/2Amax1/\sqrt{2}A_{max}. Set ω0=3\omega _0=3 and consider γ=0.1\gamma=0.1, 0.5, 1.0, 2.0. Describe the qualitative dependence of AmaxA_{max} and Δω/ωmax\Delta \omega/\omega _{max} on γ\gamma. The quantity Δω/ωmax\Delta \omega /\omega_{max} is proportional to 1/Q1/Q, where QQ is the “quality factor” of the oscillator.

  3. Decribe the qualitative behavior of the steady state amplitude A(ω)A(\omega ) near ω=0\omega=0 and ωω0\omega\gg \omega _0. Why is A(ω=0)>A(ω)A(\omega =0) > A(\omega ) for small ω\omega? Why does A(ω)0A(\omega ) \rightarrow 0 for ωω0\omega \gg \omega _0?