# ODE for a forced, undamped oscillator.

#### skatenerd

##### Active member
I have a physics problem right now, and I am so close to finishing it...
The problem is to consider an undamped (no friction) forced mass-spring system. The forcing is given by $$F(t)=F_o\cos{\omega_ft}$$
The general ODE for this would be $$\ddot{x}+(0)\dot{x}+\omega_o^2x=f_o\cos{\omega_ft}$$
The problem requires us to consider the resonant case ($$\omega_o=\omega_f$$) and the non-resonant case ($$\omega_o\neq\omega_f$$).
To acquire these two solutions, I began by using Euler's Identity to rewrite our ODE into one using exponentials rather than trigonometric functions on the right side, which was an encouraged step by the professor.
Using $$x+iy=z$$, I turned
$$\ddot{x}+\omega_o^2x=f_o\cos{\omega_ft}$$
into
$$\ddot{z}+\omega_o^2z=f_oe^{i\omega_ft}$$
(the $$y$$ part of the identity is just with a sine function on the right hand side and the variable is changed to $$y$$, with the whole thing multiplied by $$i$$.)
Solving the differential equations for the resonant case gave
$$z(t)=C_1e^{-i\omega{t}}+C_2e^{i\omega{t}}-\frac{if_o}{2\omega}e^{i\omega{t}}$$
and the non-resonant case
$$z(t)=C_1e^{-i\omega_o{t}}+C_2e^{i\omega_o{t}}+\frac{f_o}{ \omega_o^2- \omega_f^2}e^{i\omega_f{t}}$$

Now I have kind of a simple problem for the amount of stuff I just typed out...but I'm not quite sure how to find the solution in terms of $$x(t)$$.
I know that I need to take the real part of $$z(t)$$, but I am somewhat new to working with complex functions like this so I don't really know how to do that.

#### zzephod

##### Well-known member
I have a physics problem right now, and I am so close to finishing it...
The problem is to consider an undamped (no friction) forced mass-spring system. The forcing is given by $$F(t)=F_o\cos{\omega_ft}$$
The general ODE for this would be $$\ddot{x}+(0)\dot{x}+\omega_o^2x=f_o\cos{\omega_ft}$$
The problem requires us to consider the resonant case ($$\omega_o=\omega_f$$) and the non-resonant case ($$\omega_o\neq\omega_f$$).
To acquire these two solutions, I began by using Euler's Identity to rewrite our ODE into one using exponentials rather than trigonometric functions on the right side, which was an encouraged step by the professor.
Using $$x+iy=z$$, I turned
$$\ddot{x}+\omega_o^2x=f_o\cos{\omega_ft}$$
into
$$\ddot{z}+\omega_o^2z=f_oe^{i\omega_ft}$$
(the $$y$$ part of the identity is just with a sine function on the right hand side and the variable is changed to $$y$$, with the whole thing multiplied by $$i$$.)
Solving the differential equations for the resonant case gave
$$z(t)=C_1e^{-i\omega{t}}+C_2e^{i\omega{t}}-\frac{if_o}{2\omega}e^{i\omega{t}}$$
and the non-resonant case
$$z(t)=C_1e^{-i\omega_o{t}}+C_2e^{i\omega_o{t}}+\frac{f_o}{ \omega_o^2-\omega_f^2}e^{i\omega_f{t}}$$

Now I have kind of a simple problem for the amount of stuff I just typed out...but I'm not quite sure how to find the solution in terms of $$x(t)$$.
I know that I need to take the real part of $$z(t)$$, but I am somewhat new to working with complex functions like this so I don't really know how to do that.
Your particular integral for the resonant case is wrong. It cannot be periodic with frequency $$\displaystyle \omega/(2\pi)$$ which is what you have. The particular integral should be of the form $$\displaystyle y(t)=Kte^{i\omega_f t}$$

The solution in the absence of forcing will oscillate at the resonant frequency, but with forcing at resonance you are pumping energy into the system which in the absence of damping will result in the amplitude growing without bound as time passes.
.

Last edited:

#### skatenerd

##### Active member
Did you mean to write $$y(t)$$ instead of $$z(t)$$? I thought that the $$y(t)$$ function would be with sine forcing, not complex exponentials. Also, when I do use the particular solution you provided, I still am unsure of how to rewrite my answer back as a function $$x(t)$$.

#### zzephod

##### Well-known member
Did you mean to write $$y(t)$$ instead of $$z(t)$$? I thought that the $$y(t)$$ function would be with sine forcing, not complex exponentials. Also, when I do use the particular solution you provided, I still am unsure of how to rewrite my answer back as a function $$x(t)$$.
It is an arbitrary label to denote a trial function to find the correct particular integral. The name itself is of no importance.

#### skatenerd

##### Active member
Oh okay. Well my original question is how would I change my answer from $$z(t)$$ back to $$x(t)$$? In other words, from exponentials to cosine forcing?

#### zzephod

##### Well-known member
Oh okay. Well my original question is how would I change my answer from $$z(t)$$ back to $$x(t)$$? In other words, from exponentials to cosine forcing?
Take the real part of the solution.

.

#### skatenerd

##### Active member
Now I have kind of a simple problem for the amount of stuff I just typed out...but I'm not quite sure how to find the solution in terms of $$x(t)$$.
I know that I need to take the real part of $$z(t)$$, but I am somewhat new to working with complex functions like this so I don't really know how to do that.
@zzephod

#### zzephod

##### Well-known member
To find the real part of the solution, just expand the exponentials using $$\displaystyle e^{ik} = \cos(k)+i \sin(k)$$, where $$\displaystyle k$$ is real. Simplify and keep the terms that are real.

.