Example


Solve u''+0.02u'+25u=F(t), where F(t) is the periodic extension of
t+Pi/2 for -Pi<=t<=0
Pi/2-t for 0<=t<=Pi

Here L=Pi


  Clear[p1,p2,p3,p4]
  p1=Plot[t+(Pi/2), {t,-Pi,0}, DisplayFunction->Identity, 
  Ticks->{{-Pi,Pi},Automatic}];
  p2=Plot[(Pi/2)-t, {t,0,Pi}, DisplayFunction->Identity, 
  Ticks->{{-Pi,Pi},Automatic}];
  p3=Plot[t-(3Pi/2), {t,Pi,2Pi}, DisplayFunction->Identity, 
  Ticks->{{Pi,2Pi},Automatic}];
  p4=Plot[(5Pi/2)-t, {t,2Pi,3Pi}, DisplayFunction->Identity, 
  Ticks->{{2Pi,3Pi},Automatic}];
  inputF=Show[p1,p2,p3,p4,DisplayFunction->$DisplayFunction,
  Ticks->{{-Pi,Pi,2Pi,3Pi},Automatic}];

Since F(t) is an even function, the bk terms will all be zero. Let's find the ak terms.


  a0=(1/2Pi)(Integrate[t+(Pi/2),{t,-Pi,0}]+Integrate[(Pi/2)-t,{t,0,Pi}])


  a[n_]:=a[n]=(1/Pi)(Integrate[(t+(Pi/2)) u[t,Pi,n],{t,-Pi,0}]+
  Integrate[((Pi/2)-t) u[t,Pi,n],{t,0,Pi}])
  Table[a[k],{k,1,10}]

Can you see the pattern?

Can you see the pattern? ...

Let's put undetermined coefficients to work here. We need to solve u''+0.02u'+25u=4/(k^2 Pi) cos(kt) (for k odd).
Note that with L=Pi, u[t,Pi,k]=cos(kt)
We assume a solution of the form ck cos(kt) + dk sin(kt)


  testsol[t_]:=c Cos[k t]+d Sin[k t]


  D[testsol[t],{t,2}]+.02 D[testsol[t],t]+25 testsol[t]

We want to set this equal to 4/(k^2 Pi)cos(kt) (k odd) and solve for the constants c and d.


  Simplify[%]

Equating cos(kt) terms we get 25c +.02d k -c k^2=4/(k^2 Pi)
Equating sin(kt) terms we get 25d-.02c k -d k^2=0


  Clear[c,d]
  Solve[{25 c +.02 d k - c k^2==4/(k^2 Pi),
  25 d-.02 c k - d k^2==0},{c,d}];
  cc=Evaluate[c/.Flatten[%][[1]]]
  dd=Evaluate[d/.Flatten[%%][[2]]]

Note: Here % means the last calculation,
%% means two calculations back.

This is just a trick to get the output into a variable.

Remember, we only want ODD cos(k t) terms. That is what the
{n,1,10,2} is for.


  uk=Table[(cc/.k->n)Cos[n t]+(dd/.k->n)Sin[n t],{n,1,10,2}]


  uparticular=Sum[uk[[j]],{j,1,5}]


What about the homogeneous part? From above we have M=1, C=.02, K=25, so C^2<4MK and u(t) (homogeneous) is Exp[-.01 t](ACos(5 t) + BSin(5 t). As t->infinity, the homogeneous part contributes nothing to the steady state solution (do you see why?).


  sol=Plot[uparticular,{t,-Pi,3Pi}];


  Show[inputF,sol];

The steady state solution is almost harmonic (amplitudes are all close) with frequency five times that of F(t).

Notice that the sin(5 t) portion of the solution dominates: the other coefficients are quite small.

Up to Forced Oscillations