Math 325: Differential	Equations    Quiz 5    12/3/97

1. Compute the Fourier series of the function f[x_] = x on -3 <= x <= 3.

Solution

f[x] is an odd function so the coefficients a[n] = 0 and

b[n_] = 2/3 Integrate[ x Sin[(n Pi/3) x], {x,0,3}]

b[n_] = b[n] /. {Cos[n Pi] -> (-1)^n, Sin[n Pi] ->0}

f1[x_] = b[1] Sin[(1 Pi/3) x]

p1 = Plot[f1[x], {x,-3,3}, PlotStyle->RGBColor[0,0,1]]

f3[x_] = Sum[ b[n] Sin[(n Pi/3) x], {n,1,3}]

p3 = Plot[f3[x], {x,-3,3}, PlotStyle->RGBColor[0,1,0]]

f5[x_] = Sum[ b[n] Sin[(n Pi/3) x], {n,1,5}]

p5 = Plot[f5[x], {x,-3,3}, PlotStyle->RGBColor[1,0,0]]

p = Plot[x, {x,-3,3}]

Show[p,p1,p3,p5]

2. Find the solution to the heat equation 4D[u,x,x] = D[u,t] for 0<=x<=3, t>=0, subject to the boundary conditions u[0,t]=0, u[3,t]=0 for t>= 0, and u[x,0] = x for 0<=x<3.

Solution

We know that the solution will have the form
 u[x_,t_]=Sum[ b[n]Sin[(n Pi/3)x]E^(-(n Pi/3)^2 4t), {n,1,Infinity}]
where b[n] are the Fourier coefficients for f[x_] = x (the initial temperature distribution) which we already calculated in problem 1.

u1[x_,t_] = b[1] Sin[(1 Pi/3) x]E^(-(1 Pi/3)^2 4t)

p1 = Plot3D[u1[x,t], {x,0,3}, {t,0,0.5},
PlotRange->{0,3},BoxRatios->{1,1,1}]

u3[x_,t_] = Sum[b[n]Sin[(n Pi/3)x]E^(-(n Pi/3)^2 4t), {n,1,3}]

p3 = Plot3D[u3[x,t], {x,0,3}, {t,0,0.5},
PlotRange->{0,3},BoxRatios->{1,1,1}]

u5[x_,t_] = Sum[b[n]Sin[(n Pi/3)x]E^(-(n Pi/3)^2 4t), {n,1,5}]

p5 = Plot3D[u5[x,t], {x,0,3}, {t,0,0.5},
PlotRange->{0,3},BoxRatios->{1,1,1}, PlotPoints->30]