1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Forced Harmonic Oscillator C Cos wt dC/dt = 0

  1. Oct 4, 2012 #1
    I believe this is pretty standard.

    Given a mass m on a spring with spring constant k, a solution to the second order differential equation of motion m[itex]\ddot{x}[/itex] = -kx, is x = cos ωot, and ωo = [itex]\sqrt{k/m}[/itex].

    If that same oscillator is driven with a force F(t) = Fo cos ωt the equation of motion becomes m[itex]\ddot{x}[/itex] = -kx + F(t). If we try x = C cos ωt as a solution, we find it works (mathematically) if C = Fo/m(ωo22).

    But this doesn't seem real. It says x is going to trace out a cos curve when plotted against time. If I'm applying a force to the oscillator at a frequency different form its natural frequency, sometimes the spring force and the driving force will be in the same direction, and other times they will be in opposition. That will lead to a more complex motion than C cos ωt.

    The math gives us the solution, but it doesn't seem to make physical sense. I believe in resonance, and the general notion that the the amplitude will be greater as ωo→ω.

    I've seen this developed in one form or another several times, and every time, my mind rebelled, but I just forced myself to accept it.

    I cannot think of a situation in nature in which C cos ωt would be the actual motion of the oscillator. Supposedly this solution applies to a mass on a spring. Can anybody give me an instance in which the motion of the mass would actually conform to C cos ωt?
  2. jcsd
  3. Oct 5, 2012 #2


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    What you have calculated is one possible solution. The only problem you have is that you have to fulfill initial conditions. This you can do by adding the general solution of the homogeneous differential equation to your particular solution of the inhomogeneous one to get the most general solution:
    [tex]x(t)=C \cos(\omega t)+A \cos(\omega_0 t)+B \sin(\omega_0 t).[/tex]
    The particular solution becomes more sensible if you have a damped oscillator. Then, after a time large compared to the damping time, the solutions of the homogeneous equation become small due to damping, and what's left is only the particular solution. Then also there is no resonance catastrophe at [itex]\omega=\omega_0[/itex] for this solution. So your special solution makes much more sense in this case as the description of the long-time behavior of the particle's motion.
  4. Oct 5, 2012 #3
    that is not seeming real because you have not included damping which is necessary(physically) because in simple cases it is proportional to velocity and if you will solve it by means of fourier transform then you will find that the singularity which will be lying on real axis ,now will get an imaginary part and the contour integration does not contain any ambiguity which it will if no damping is present.so both physically and mathematically it is a required condition.
  5. Oct 5, 2012 #4


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Not necessarily! You are right that the damping makes the Fourier transform less troublesome, but also the undamped oscillator can be treated without ambiguities via Fourier transform.

    The equation for the driven oscillator reads
    [tex]\ddot{x}+\omega_0^2 x=F(t).[/tex]
    To solve this equation, we can first look for the Green's function of the differential operator on the left-hand side:
    [tex]\partial_t^2 G(t,t')+\omega_0^2 G(t,t')=-\delta(t-t').[/tex]
    It's clear, due to temporal translation invariance that
    where [itex]g[/itex] fulfills the equation
    [tex]\ddot{g}+\omega_0^2 g=-\delta(t).[/tex]
    With the ansatz
    [tex]g(t)=\int_{\mathbb{R}} \frac{\mathrm{d} \omega}{2 \pi} \tilde{g}(\omega) \exp(-\mathrm{i} \omega t),[/tex]
    you get from the differential equation
    Of course, then you run into the problem with the poles at [itex]\omega = \pm \omega_0[/itex] when plugging this back into the Fourier-integral ansatz.

    However, it's clear that the problem is not uniquely determined since we need to provide appropriate boundary conditions. In this case, we may choose to get the retarded propagator and deform the contour in the complex [itex]\omega[/itex] problem accordingly it's well known, that this is achieved by the retardation condition [itex]g(t) \propto \Theta(t)[/itex], and this means that we should move the poles of [itex]\tilde{g}[/itex] slightly to the lower half-plane. This gives the solution
    [tex]\tilde{g}(\omega)=\frac{1}{(\omega+\mathrm{i} 0^+)^2-\omega_0^2}.[/tex]
    Then we can close the integration path by a large semicircle in the upper or lower [itex]\omega[/itex] half-plane, depending wheter [itex]t>0[/itex] of [itex]t<0[/itex] respectively. Of course this solution of the problem is in fact nothing else than to introduce an infinitesimal damping constant into the problem. Using the residuum theorem this finally gives
    [tex]g(t)=\frac{\Theta(t)}{\omega_0} \sin(\omega_0 t).[/tex]
    We can check this by taking the time derivatives
    [tex]\dot{g}(t)=\Theta(t) \cos(\omega_0 t), \quad \ddot{g}(t)=-\Theta(t) \omega_0 \sin(\omega_0 t)+\delta(t).[/tex]
    Pluggint this into the equation for the Green's function, this indeed proves that this function solves the equation.

    The general solution of the inhomogeneous equation is then given by
    [tex]x(t)=-\int_0^t \mathrm{d} t' \; g(t-t') F(t')+A \cos(\omega_0 t) + B \sin(\omega_0 t),[/tex]
    where [itex]A,B[/itex] are integration constants, determined by the initial conditions [itex]x(0)=x_0[/itex] and [itex]\dot{x}(0)=v_0[/itex]. This also shows that folding of the external force with the retarded Green's function with the particular choice of [itex]t=0[/itex] for the lower boundary of the integration gives the solution of the driven oscillator with the homogeneous initial conditions [itex]\dot{x}(0)=\dot{x}(0)=0[/itex].
  6. Oct 5, 2012 #5
    I was hoping for a physical example. An oscillator with a very low damping term should suffice to demonstrate what I am trying to understand. The differential equation of an ideal mass on a spring, driven by a force varying as cosine has a solution that varies at that same frequency in a pure cosine.

    If I simply program the equations of motion into a computer and evolve the system I see clearly that the actual behavior is not a pure cosine. Math gives us a solution, but nature does not seem to care about our math.
  7. Oct 5, 2012 #6

    Ken G

    User Avatar
    Gold Member

    Nature cares a great deal about our math, but you have to give it the right math. As vanhees71 explained in some detail, your solution is not the general one. If you program the equation with some initial condition, you will get vanhees71's general solution as your solution, and that is also what nature will do.

    So if your complaint is that nature doesn't do the cosine solution, note that the math doesn't either. However, there are many situations where nature will do the cosine solution, and they have been pointed out as well-- include a tiny damping, as is inevitable in any real system (any system that is not a perpetual motion machine), and let it be driven for a very long time (much longer than the dissipation time, which is the e-folding time for the oscillation if you turn off the driving and see that it was not a perpetual motion machine). Do that, in real life or in your computer, and you will get the cosine solution.
  8. Oct 5, 2012 #7
    I'll have to admit, for a lot of parameters, I get a pretty clean looking cosine "wave". For some, I get what looks like "beat notes". For others I get what look like "drunken" wave forms.

    I wish I had an easy way to post Mathematica code so I could show what I'm actually doing. This is the best I can come up with:

    Code (Text):

    k=2.57\[Omega]^2 m;
    V[v_,a_,\[CapitalDelta]t_]:=v+a \[CapitalDelta]t
    X[x_,v_,\[CapitalDelta]t_]:=x + v \[CapitalDelta]t
    F[t_,\[Omega]_,c_]:=c Cos[\[Omega] t]
    f[x_,k_]:=-x k

  9. Oct 5, 2012 #8
    The solution I posted has initial conditions. Can you solve for them?

    See Feynman Vol I 21-4.
  10. Oct 6, 2012 #9
    I'm open to the possibility that my code sucks. If anybody can show an error in my model that accounts for the non-cosine result, please let me know. Here's what I ran:

    Code (Text):

    v = 0;
    x = 1.5;
    a = 0;
    t = 0;
    dt = .0005;
    c = 3;
    w = \[Pi];
    m = .2;
    k = .135 w^2 m;
    V[v_, a_, dt_] := v + a dt
    X[x_, v_, dt_] := x + v dt
    F[t_, w_, c_] := c Cos[w t]
    f[x_, k_] := -x k
    A[x_, k_, t_, w_, c_, m_] := (F[t, w, c] + f[x, k])/m
    pts = {};

    For[i = 0, i <= 100000, i++,
     a = A[x, k, t, w, c, m];
     v0 = v;
     v = V[v, a, dt];
     x = X[x, (v + v0)/2, dt];
     If[0 == Mod[i, 100], pts = Append[pts, {t, x}]];
     t += dt;
    This is the result:


    I might do well to increase the precision of the calculations, but I doubt it will significantly alter the result.

    Attached Files:

  11. Oct 6, 2012 #10


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    If I understand your code right, it solves in a simple way the ODE of an undamped oscillator
    [tex]m \ddot{x}+k x=C \cos(\omega t).[/tex]
    This is precisely the case, I've treated in my previous posting. Just rewrite it a bit, and with
    [tex]\omega_0=\sqrt{\frac{k}{m}},\quad c=\frac{C}{m}[/tex]
    the equation reads
    [tex]\ddot{x} + \omega_0^2 x=c \cos(\omega t).[/tex]
    Then according to my corrected Green's function (I had a sign error in the final result) you get for a particular solution of the inhomogeneous equation, with homgeneous boundary conditions
    [tex]x^{(i)}(t)=\frac{c}{\omega_0} \int_0^{t} \mathrm{d} t' \sin[\omega_0 (t-t')] \cos(\omega t')=\frac{c}{\omega_0^2-\omega^2} [\cos(\omega t)-\cos(\omega_0 t)].
    Now you want to fulfill the initial conditions [itex]x(0)=x_0, \quad \dot{x}(0)=0[/itex]. Obviously you have to add the corresponding solution with these boundary conditions of the homogeneous equations to it:
    [tex]x^{(h)}(t)=x_0 \cos(\omega_0 t).[/tex]
    So your solution is
    [tex]x(t)=x_0 \cos(\omega_0 t) + \frac{c}{\omega_0^2-\omega^2} [\cos(\omega t)-\cos(\omega_0 t)].
    Plotting this with the values from your program (I used Mathematica) shows that your numerical result seems to be pretty accurate. :smile:
  12. Oct 6, 2012 #11


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Unfortunately it seems to be impossible to edit older postings. So here is my derivation of the Green's function again with the correct sign:

  13. Oct 6, 2012 #12

    I put in a damping term, and it does seem (upon first trying,) to stabilize into a cosine wave. But that begs the question. What does a solution mean, if nature doesn't conform to it?
  14. Oct 6, 2012 #13
    That's interesting. I have to admit, I don't fully understand it. I'm sure I will have to learn about Green's function if I am to understand more advanced physics. That probably won't happen this weekend.

    Why should I initialize x to zero? It seems that xo could be an arbitrary displacement, and still solve the original ODE.
  15. Oct 6, 2012 #14
    Well, a nature where there is no damping will conform to any solution of your undamped forced harmonic oscillator.
    You can get an approximation to it if you look at a system with low enough damping.
    During the so-called "transient regime", you will see all kind of complex waveforms, until all the "transients" are damped and the system oscillates nicely with the frequency of the driving force.
  16. Oct 6, 2012 #15


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    The idea was to first solve the inhomogeneous equation (i.e., the one with the external force acting) with homogeneous initial conditions [itex]x(0)=\dot{x}(0)[/itex] and then to add a solution of the homogeneous equation (i.e., without the external force) with the initial conditions given in your code. Of course you can solve the equation (also with your code numerically by the way) with arbitrary initial conditions [itex]x(0)=x_0[/itex] and [itex]\dot{x}(0)=v_0[/itex]. This most general solution then obviously reads

    [tex]x(t)=\frac{c}{\omega_0^2-\omega^2}[\cos(\omega t)-\cos(\omega_0 t)] + x_0 \cos(\omega t) + \frac{v_0}{\omega_0} \sin(\omega_0 t).[/tex]
  17. Oct 6, 2012 #16

    Ken G

    User Avatar
    Gold Member

    I don't understand your question-- nature has damping (no perpetual motions machines), and when you put in damping, you get the cosine wave. So why is your conclusion not that the cosine solution means exactly what nature conforms to? You just have to wait a little while, that solution applies to systems that are being driven over many many cycles. That is quite common in nature, actually, just think about waves lashing a shore, or a flute being blown into, or light scattering off a molecule. It is the general nature of "resonance phenomena," and it's nature, not just a math solution.
  18. Oct 6, 2012 #17
    First of all, there are perpetual motion machines. They are also known as atoms. Now, I know I'm not permitted to think about subatomic particles as things in motion, but I'm not much on adhering to unsubstantiated dogma.

    My point regarding the cosine solution to the driven harmonic oscillator has to do with how to interpret the math. I know about transient solutions, damping, etc. The frictionless idealized oscillator can be reasonably meaningfully approximated. It is evident to me that removing the damping from a driven harmonic oscillator will result in it acquiring new deviations from a pure cosine motion.

    It's pretty clear that the "real" solution that nature chooses is a superposition of different solutions.

    The understanding I am seeking has nothing to do with damping.
  19. Oct 6, 2012 #18
    If I ease the driving force on by making C a slowly increasing time dependent variable, the system does appear to approximate a cosine wave much more accurately. Apparently there is an ideal balance in which the homogeneous solution, alone attains. Now I've gotta figure out what that means, or even if it's really true.
  20. Oct 7, 2012 #19
    that is the requirement of causality and so it will not be appropriate to call it a boundary condition.in a pure math way, the poles on real axis do cause ambiguity which can be handled by principal value concept.In case the retarded propagator is obtained by making a specific detour around the pole lying on real axis or otherwise giving a shift of poles in Im direction to make physically sensible result.however the case of advanced propagators can not also be denied but that is just not expected on the physical ground
    edit:wheeler feynman absorber theory never gave a satisfactory definition of advanced propagation or at least it was not successful.
  21. Oct 7, 2012 #20


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    Sure, also the advanced solution is a solution of your equation. The most general solution is always the superposition of a particular solution of the inhomogeneous equation and the general solution of the homogeneous one. The motion is only completely determined as soon as the initial conditions are specified.

    Applying this to Green's functions tells you that two Green's functions differ by a solution of the homogeneous equation. So you can as well write any solution as the superposition of the solution of the inhomogeneous equation using the advanced Green's function and the general solution of the homogeneous one. As soon as you plug in specific initial conditions the difference between the retarded and advanced solution will be compensated.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Forced Harmonic Oscillator C Cos wt dC/dt = 0
  1. Harmonic Oscillator (Replies: 0)

  2. Harmonic Oscillator (Replies: 2)

  3. Harmonic oscillator (Replies: 6)