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

Chapter 1

Maple code for exercises in section 1.2

1.

The command jf[n,x] produces the first n terms of the Fourier cosine expansion of the constant function 1.

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

 > for n from 1 to 4 do plot(jf(n,x),x = -1 .. 3) end do;

2.

The vector v lists all of the values at which we want to evalate the function jf[n,x] defined in exercise 1. The plots[listplot] commands generate lists of the values of the partial sums of this series evaluated at x = 0.99 and x = 0.999, respectively.

 > seq([jf(100,v)],v=[0,0.5,0.9,0.99,1.1,2]);

 > plots[listplot]([seq([n, jf(n,.99)],n = [seq(100+100*i,i = 0 .. 19)])]);

 > plots[listplot]([seq([n, jf(n,.999)],n = [seq(100+100*i,i = 0 .. 19)])]);

3.

This command evaluates the sum of the first 10*2^n terms in the given series.

 > [seq(evalf(Sum(1/(2*k-1),k = 1 .. 10*2^n)),n = 0 .. 10)];

4.

We denote the sum of the first n terms of this series as

 > z :=  (n, x, w) -> evalf(4/Pi*sum((-1)^(k-1)*exp(-(2*k-1)*Pi*w/2)*cos((2*k-1)*Pi*x/2)/(2*k-1),k = 1 .. n));

and then do a 3-dimensional plot using

 > for n from 1 to 4 do plot3d(z(n,x,w),x = -1 .. 1,w = 0 .. .6) end do;

5.

The following command will compute the first n terms of the series

 > s := n -> evalf(Sum((-1)^floor(1/2*k-1/2)/(6*floor(1/2*k)+(-1)^(k-1)),k = 1 .. n));

 > [seq(s(n),n = 1 .. 20)];

7.

The following command will compute the first n terms of the series

 > g := (n, x) -> evalf(2*sum((-1)^i*sin(1/2*(-1+2*i)*Pi*x),i = 1 .. n));

 > for n from 10 by 10 to 50 do plot(g(n, x), x = -1 .. 3, y = -10 .. 10, adaptive = false, numpoints = 1000) end do;

 > [seq(g(n,0),n = 1 .. 20)];

 > [seq(g(n,.2),n = 1 .. 20)];

 > [seq(g(n,.3),n = 1 .. 20)];

 > [seq(g(n,.5),n = 1 .. 20)];

 >