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

In[6]:=

  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.

In[7]:=

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

Out[7]=

  0

In[8]:=

  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}]

Out[8]=

   4       4         4         4         4
  {--, 0, ----, 0, -----, 0, -----, 0, -----, 0}
   Pi     9 Pi     25 Pi     49 Pi     81 Pi

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)

In[9]:=

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

In[10]:=

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

Out[10]=

       2                2
  -(c k  Cos[k t]) - d k  Sin[k t] + 
   
    25 (c Cos[k t] + d Sin[k t]) + 
   
    0.02 (d k Cos[k t] - c k Sin[k t])

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

In[11]:=

  Simplify[%]

Out[11]=

                                         2
  25 c Cos[k t] + 0.02 d k Cos[k t] - c k  Cos[k t] + 
   
                                           2
    25 d Sin[k t] - 0.02 c k Sin[k t] - d k  Sin[k t]

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

In[12]:=

  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]]]

Out[12]=

                          2
           -4. (25. - 1. k )
  ------------------------------------
           2            4            6
  -1963.5 k  + 157.078 k  - 3.14159 k

Out[13]=

                -0.08 k
  ------------------------------------
           2            4            6
  -1963.5 k  + 157.078 k  - 3.14159 k

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.

In[14]:=

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

Out[14]=

  {0.0530516 Cos[t] + 0.0000442097 Sin[t], 
   
    0.00884182 Cos[3 t] + 0.0000331568 Sin[3 t], 
   
    0. Cos[5 t] + 0.509296 Sin[5 t], 
   
                                     -6
    -0.00108265 Cos[7 t] + 6.31546 10   Sin[7 t], 
   
                                     -7
    -0.000280694 Cos[9 t] + 9.0223 10   Sin[9 t]}

In[15]:=

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

Out[15]=

  0.0530516 Cos[t] + 0.00884182 Cos[3 t] + 0. Cos[5 t] - 
   
    0.00108265 Cos[7 t] - 0.000280694 Cos[9 t] + 
   
    0.0000442097 Sin[t] + 0.0000331568 Sin[3 t] + 
   
                                  -6
    0.509296 Sin[5 t] + 6.31546 10   Sin[7 t] + 
   
             -7
    9.0223 10   Sin[9 t]


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

In[16]:=

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

In[17]:=

  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