18.03 Problem Set 8.5

Final Exam: Wednesday, May 19, 9:00–12:00

This is another set of problems not to be handed in, just to give you practice on these last subjects. The Matlab material is optional.

Syllabus

V. Fourier Series and Partial Differential Equations

36. (W 5 May) Fourier series: EP 8.1.

37. (F 7 May) Applications: EP 8.4.

38. (M 10 May) Heat Equation: EP 8.5.

39. (W 12 May) Wave Equation: EP 8.6 (631–639).

Part I.

37. (F 7 May) EP 8.3: 19, 20.

38. (M 10 May) Nothing new.

39. (W 12 May) EP 8.6: 1, 3, 6.

Part II.

Here is a corrected version of the routine cf.m offered up in 36. In effect it uses the trapezoidal rule.

     function y=cf(vector,n)
     N=length(vector);
     t=linspace(-pi,pi,N);
     y(1)=(sum(vector)-(vector(1)+vector(N))/2)/(N-1);
     for k=2:n+1
     y(k)=2*(sum(cos((k-1)*t).*vector)-(vector(1)+vector(N))/2)/(N-1);
     y(n+1+k)=2*sum(sin((k-1)*t).*vector))/(N-1);
     end

37. (F 7 May) (a) Using integration by parts, find the Fourier coefficients of the function defined by f(t) = t for −π < t < π, f(t + 2π) = f(t). [Answer: a_{n} = 0, b_{n} = −2(−1)^{n}/n; see EP 8.3 (16).]

(b) Now suppose we have the ODE ẍ + kx = f(t), k > 0, where f(t) is as in (a). Work out the Fourier coefficients of the solutions to this ODE which are periodic of period 2π, if such exist. [Answer: a_{n} = 0, b_{n} = −2(−1)^{n}/n(k − n^{2}), provided that k is not a square integer; there is then a unique periodic solution. If k is a square integer then no periodic solutions exist.] (c) Use Matlab as suggested in 36. to see how well the Fourier series approximates f(t). Then create a routine like the one printed above to create the vector of the Fourier coefficients through a_{n}, b_{n} you found in (b). Hint: here’s the routine csq.m I used to produce the vector of the Fourier coefficients through a_{n}, b_{n} for the periodic solution to ẍ + kx = sq(t), as described in class:

     function v=csq(n,k)
     for j=1:n
     v(n+2+j)=-2*(1-(-1)^j)/(pi*j*(j*j-k));
     end

Finally, take n pretty large, say n = 100, and experiment with what happens as you vary k.

(d) Recall the square wave sq(t) = −1 for −π < t < 0, sq(t) = 1 for 0 < t < π, and its Fourier series

sq(t) = ∑_{n=1,odd}^{∞} \frac{sin(nt)}{n}.  (1)

Differentiate this Fourier expression term-by-term to get an expression for the derivative

of sq(t). [Answer: sq′(t) = \frac{4}{π} ∑_{n=1,odd}^{∞} cos(nt).]

(e) We can consider a “generalized periodic function” which we denote (by an abuse of notation) δ_{a}, with the characteristic property that

∫_{−π}^{π} δ_{a}(t)g(t)dt = g(a)  (2)

for any decent periodic function g. Using this, compute the Fourier coefficients of δ_{0} and

of δ_{π}. [Answers: δ_{0}(t) = \frac{1}{2π} + \frac{1}{π} ∑_{n=1}^{∞} cos(nt), δ_{π}(t) = \frac{1}{2π} + \frac{1}{π} ∑_{n=1}^{∞}(−1)^{n} cos(nt).] It looks

as though we could write sq′(t) = 2(δ_{0}(t) − δ_{π}(t)). Check that the Fourier coefficients are right for this.

(f) Construct a routine which creates a vector consisting of the Fourier coefficients through a_{n}, b_{n} for δ_{0}, suitable for feeding to fsum.m. Then feed this to fsum.m to create a vector of values, create a corresponding vector of t values, and plot the result, for n = 2, 4, 8, 100. Do these seem to approximate the delta function?

38. (M 10 May) (a) Starting with (2) again, calculate:

δ_{π/2}(t) = \frac{1}{2π} + \frac{1}{π} (sin(t) − cos(2t) − sin(3t) + cos(4t) + sin(5t) − cos(6t) − + + ⋯)

δ_{−π/2}(t) = \frac{1}{2π} + \frac{1}{π} (− sin(t) − cos(2t) + sin(3t) + cos(4t) − sin(5t) − cos(6t) + + − ⋯)

δ_{π/2}(t) − δ_{−π/2}(t) = \frac{2}{π} ∑_{k=0}^{∞}(−1)^{k} sin((2k + 1)t)

δ_{π/2}(t) + δ_{−π/2}(t) = \frac{1}{π} + \frac{2}{π} ∑_{k=1}^{∞}(−1)^{k} cos(2kt)

(b) Use (a) to write down the solution u(x, t) to the heat equation

\frac{∂u}{∂t} = \frac{∂^{2}u}{∂x^{2}}  (3)

with boundary conditions u(0, t) = u(π, t) = 0, u(x, 0) = δ_{π/2}(t): a very hot spot at the center of the interval, and the ends kept cold. The heat spreads from the hotspot.

[Answer: u(x, t) = \frac{2}{π} ∑_{k=0}^{∞}(−1)^{k}e^{−(2k+1)^{2}t} sin((2k + 1)x). Notice that almost immediately

all the overtones are damped out to a much greater degree than the fundamental, and that consequently the heat distribution is well approximated by (2/π)e^{−t} sin(x).]

(c) Use (a) to write down a solution u(x, t) to (3) subject to the boundary conditions

\frac{∂u}{∂x}(0, t) = 0 = \frac{∂u}{∂x}(l, t), u(x, 0) = δ_{π/2}(x): a very hot spot in the middle, and the ends

insulated. [Answer: u(x, t) = \frac{1}{π} + \frac{2}{π} ∑_{k=1}^{∞}(−1)^{k}e^{−4k^{2}t} cos(2kx). Again, almost immediately

this gets very close to 1/π − (2/π)e^{−4t} cos(2x). This in turn decays rather quickly to the constant function whose value is the average value of the heat content of the bar, 1/π.]