# Forced Harmonic Oscillator C Cos wt dC/dt = 0

1. Oct 4, 2012

### Hetware

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$\ddot{x}$ = -kx, is x = cos ωot, and ωo = $\sqrt{k/m}$.

If that same oscillator is driven with a force F(t) = Fo cos ωt the equation of motion becomes m$\ddot{x}$ = -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. Oct 5, 2012

### vanhees71

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:
$$x(t)=C \cos(\omega t)+A \cos(\omega_0 t)+B \sin(\omega_0 t).$$
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 $\omega=\omega_0$ 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.

3. Oct 5, 2012

### andrien

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.

4. Oct 5, 2012

### vanhees71

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
$$\ddot{x}+\omega_0^2 x=F(t).$$
To solve this equation, we can first look for the Green's function of the differential operator on the left-hand side:
$$\partial_t^2 G(t,t')+\omega_0^2 G(t,t')=-\delta(t-t').$$
It's clear, due to temporal translation invariance that
$$G(t,t')=g(t-t'),$$
where $g$ fulfills the equation
$$\ddot{g}+\omega_0^2 g=-\delta(t).$$
With the ansatz
$$g(t)=\int_{\mathbb{R}} \frac{\mathrm{d} \omega}{2 \pi} \tilde{g}(\omega) \exp(-\mathrm{i} \omega t),$$
you get from the differential equation
$$\tilde{g}(\omega)=\frac{1}{\omega^2-\omega_0^2}.$$
Of course, then you run into the problem with the poles at $\omega = \pm \omega_0$ 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 $\omega$ problem accordingly it's well known, that this is achieved by the retardation condition $g(t) \propto \Theta(t)$, and this means that we should move the poles of $\tilde{g}$ slightly to the lower half-plane. This gives the solution
$$\tilde{g}(\omega)=\frac{1}{(\omega+\mathrm{i} 0^+)^2-\omega_0^2}.$$
Then we can close the integration path by a large semicircle in the upper or lower $\omega$ half-plane, depending wheter $t>0$ of $t<0$ 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
$$g(t)=\frac{\Theta(t)}{\omega_0} \sin(\omega_0 t).$$
We can check this by taking the time derivatives
$$\dot{g}(t)=\Theta(t) \cos(\omega_0 t), \quad \ddot{g}(t)=-\Theta(t) \omega_0 \sin(\omega_0 t)+\delta(t).$$
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
$$x(t)=-\int_0^t \mathrm{d} t' \; g(t-t') F(t')+A \cos(\omega_0 t) + B \sin(\omega_0 t),$$
where $A,B$ are integration constants, determined by the initial conditions $x(0)=x_0$ and $\dot{x}(0)=v_0$. This also shows that folding of the external force with the retarded Green's function with the particular choice of $t=0$ for the lower boundary of the integration gives the solution of the driven oscillator with the homogeneous initial conditions $\dot{x}(0)=\dot{x}(0)=0$.

5. Oct 5, 2012

### Hetware

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.

6. Oct 5, 2012

### Ken G

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.

7. Oct 5, 2012

### Hetware

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):

v=0;
x=.1;
a=0;
t=0;
\[CapitalDelta]t=.01;
c=1;
\[Omega]=\[Pi];
m=.1;
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
A[x_,k_,t_,\[Omega]_,c_,m_]:=(F[t,\[Omega],c]+f[x,k])/m
pts={};

For[i=0,i<=5000,i++,
a=A[x,k,t,\[Omega],c,m];
v0=v;
v=V[v,a,\[CapitalDelta]t];
x=X[x,(v+v0)/2,\[CapitalDelta]t];
pts=Append[pts,{t,x}];
t+=\[CapitalDelta]t;
]
Graphics[Line[pts]]

8. Oct 5, 2012

### Hetware

The solution I posted has initial conditions. Can you solve for them?

See Feynman Vol I 21-4.

9. Oct 6, 2012

### Hetware

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;
]
Graphics[Line[pts]]

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:

• ###### fho-01.jpg
File size:
19.9 KB
Views:
252
10. Oct 6, 2012

### vanhees71

If I understand your code right, it solves in a simple way the ODE of an undamped oscillator
$$m \ddot{x}+k x=C \cos(\omega t).$$
This is precisely the case, I've treated in my previous posting. Just rewrite it a bit, and with
$$\omega_0=\sqrt{\frac{k}{m}},\quad c=\frac{C}{m}$$
$$\ddot{x} + \omega_0^2 x=c \cos(\omega t).$$
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
$$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 $x(0)=x_0, \quad \dot{x}(0)=0$. Obviously you have to add the corresponding solution with these boundary conditions of the homogeneous equations to it:
$$x^{(h)}(t)=x_0 \cos(\omega_0 t).$$
$$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.

11. Oct 6, 2012

### vanhees71

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:

12. Oct 6, 2012

### Hetware

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?

13. Oct 6, 2012

### Hetware

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.

14. Oct 6, 2012

### nasu

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.

15. Oct 6, 2012

### vanhees71

The idea was to first solve the inhomogeneous equation (i.e., the one with the external force acting) with homogeneous initial conditions $x(0)=\dot{x}(0)$ 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 $x(0)=x_0$ and $\dot{x}(0)=v_0$. This most general solution then obviously reads

$$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).$$

16. Oct 6, 2012

### Ken G

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.

17. Oct 6, 2012

### Hetware

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.

18. Oct 6, 2012

### Hetware

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.

19. Oct 7, 2012

### andrien

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.

20. Oct 7, 2012

### vanhees71

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.