The Mathematica notebook is chapt1_1_3.nb.

The Maple notebook is but you are warned that it may download as a text file.

Approximating Fourier's Solution

This notebook provides explorations of the general solution to the heat-flow problem. Click on the formula given below and then press the ENTER key. When you are asked if you want to evaluate all the initialization cells, answer YES. When Mathematica warns that there might be a problem, proceed and answer EVALUATE.

> z :=(x,w) -> Sum(a[i]*exp((1/2*(2*i-1)*(-Pi)*w))*(cos(1/2*(2*i-1)*Pi*x)),i = 1 .. nops(a));

z := proc (x, w) options operator, arrow; Sum(a[i]*exp(-1/2*(2*i-1)*Pi*w)*cos(1/2*(2*i-1)*Pi*x), i = 1 .. nops(a)) end proc

The variable a is a list of the coefficients. For example, we might have a = {1,-1/2,1/3,-1/4,1/5}. This definition of z uses the length of the list to determine the number of summands. The following input enters these values and returns the resulting function z.

> a := [1, -1/2, 1/3, -1/4, 1/5]:

Sum([1, (-1)/2, 1/3, (-1)/4, 1/5][i]*exp(-1/2*(2*i-1)*Pi*w*cos(1/2*(2*i-1)*Pi*x)), i = 1 .. 5)

The  first command produces a 3-dimensional plot of z(x,w), the second produces the cross-section parallel to the w-axis at x=0, and the third produces the cross-section above the x-axis.

> plot3d(z(x, w), x= -1.. 1, w= 0.. 2);

> plot(z(0, w), w= 0.. 2);

> plot(z(x, 0), x= -1.. 1);

Fourier's approximation to the constant function 1

The first line enters the function FS(n,x), the first n terms of Fourier's approximation to the constant function 1.  The second line graphs this truncated Fourier series. It is set up to use 6 terms. This value can be changed. The third line intrdouces the solution to the heat equation, a function of both x and w. The fourth line graphs the resulting surface that shows the solution of the heat equation. Again, this has been set up to use the first 6 terms, but this parameter can be varied.

> FS :=  (n, x) -> 4/Pi*sum((-1)^(i-1)/(2*i-1)*cos(1/2*(2*i-1)*Pi*x),i = 1 .. n) ;

FS := proc (n, x) options operator, arrow; 4*(sum((-1)^(i-1)*cos(1/2*(2*i-1)*Pi*x)/(2*i-1), i = 1 .. n))/Pi end proc

> plot(FS(6,x), x=-1..1);


> FSS := (n,x,w) -> 4/Pi*sum((-1)^(i-1)/(2*i-1)*exp(1/2*(-2*i+1)*Pi*w)*cos(1/2*(2*i-1)*Pi*x),i = 1 .. n);

FSS := proc (n, x, w) options operator, arrow; 4*(sum((-1)^(i-1)*exp(1/2*(-2*i+1)*Pi*w)*cos(1/2*(2*i-1)*Pi*x)/(2*i-1), i = 1 .. n))/Pi end proc

> plot3d(FSS(6,x,w), x=-1..1, w=0..2);