Assume you have an instrument designed to be resonant at the B below middle C
(which has frequency 246.942 Hz; assume a Q of 50)
The instrument is driven with a triangle wave and then with a saw tooth wave
both at 60 Hz ("power line frequency").  Show the output.

We need to sum the series that is Eq. 5.94 in the textbook,
Clearly we can't sum an infinite number of terms; limit our sum to n=10

The driving frequency is
w=2 Pi 60

The paramters describing the instrument:
w0=2 Pi 246.942
Q=50
b=w0/2/Q

A term in the sum (i.e., a solution to dampled cosine driven SHO)

cterm[n_]:=Re[ 1/(w0^2-(n w)^2+2 b n w I) Exp[I n w t]]

This nicely includes both the phase shift and the frequency dependent amplitude.
The Fourier series tells us the amplitude of each one of the harmonics

even triangle:
FourierTrigSeries[-Pi/2+Abs[t],t,5]    
        -4 Cos[t]   4 Cos[3 t]   4 Cos[5 t]
Out[7]= --------- - ---------- - ----------
           Pi          9 Pi        25 Pi
odd sawtooth:
FourierTrigSeries[t,t,5]
                              2 Sin[3 t]   Sin[4 t]   2 Sin[5 t]
Out[8]= 2 Sin[t] - Sin[2 t] + ---------- - -------- + ----------
                                  3           2           5

It is a little unfair to compare these two as sawtooth has a peak-to-peak amplitude
of 2 Pi and triangle has a peak-to-peal amplitude of Pi, so in the following
we'll cut the sawtooth amplitude in half.

tri[t_]=Sum[FourierCosCoefficient[-Pi/2+Abs[t],t,n] cterm[n],{n,1,10,2}]

The saw tooth is actually a sum of SIN (not COS) so we need the equivalent of
Eq 5.94 for damped sine driven SHO:

sterm[n_]:=Im[ 1/(w0^2-(n w)^2+2 b n w I) Exp[I n w t]]

saw[t_]=Sum[FourierSinCoefficient[t/2,t,n] sterm[n],{n,1,10,1}]

triPlot=Plot[tri[t],{t,0,1/30}]
sawPlot=Plot[saw[t],{t,0,1/30}]

In Europe the power line frequency is 50 Hz
w=2 Pi 50
w0=2 Pi 246.942
Q=50
b=w0/2/Q

triE[t_]=Sum[FourierCosCoefficient[-Pi/2+Abs[t],t,n] cterm[n],{n,1,10,2}]
sawE[t_]=Sum[FourierSinCoefficient[t/2,t,n] sterm[n],{n,1,10,1}]
triEPlot=Plot[triE[t],{t,0,1/30}]
sawEPlot=Plot[sawE[t],{t,0,1/30}]

GraphicsGrid[{{triPlot,triEPlot},{sawPlot,sawEPlot}}]
Export["fourier_sum.pdf",%]

If you measure carefully you'll see that the response to the lower European frequency (50 Hz)
is actually higher than the response to the American frequency (60 Hz). Why?

