MATH3271 - FW03

Assignment 1

Question 1(a)

 > f:= cos(x) + sin(3*x);

 > plot(f,x=-3*Pi..3*Pi, colour = black);

The period of f is 2*Pi.

Question 1(b)

 > g:=cos(x)*sin(3*x);

 > plot(g,x=-2*Pi..2*Pi,colour = black);

The period of g is Pi.

Question 1(c).

 > h:= cos(2*Pi*x/3);

 > plot(h, x=-6..6,colour=black);

The period of h is 3.

Question 1(d)

 > p:=floor(x)-2*floor(x/2);

 > plot(p,x = -4..4,colour=black);

The period of p is 2.

Question 3(b)(i)

 > f:=cos(x/2);

 > s4:=(2+4/3*cos(x) -4/15*cos(2*x)+4/35*cos(3*x)-4/63*cos(4*x))/Pi;

 > s6:=s4+(4/99*cos(5*x)-4/143*cos(6*x))/Pi;

 > plot([f,s4,s6],x=-Pi..Pi,colour=black);

Question 3(b)(ii)

 > f:=Heaviside(-x-1)+Heaviside(x-1);

 > s4:=1/2 +2/Pi*(-cos(Pi*x/2)+1/3*cos(3*Pi*x/2));

 > s6:=s4+2/Pi*(-1/5*cos(5*Pi*x/2));

 > plot([f,s4,s6],x=-2..2,colour=black);

Question 4(b)

Even extension

 > e: = 1 - abs(x);

 > s3:=1/2+4/Pi^2*(cos(Pi*x)+1/9*cos(3*Pi*x));

 > s5:=s3+4/Pi^2*1/25*cos(5*Pi*x);

 > plot([e,s3,s5],x = -1..1,colour=black);

Odd extension

 > c:=x/abs(x)-x;

 > s3:=2/Pi*(sin(Pi*x)+1/2*sin(2*Pi*x)+1/3*sin(3*Pi*x));

 > s5:=s3+2/Pi*(1/4*sin(4*Pi*x)+1/5*sin(5*Pi*x));

 > plot([c,s3,s5],x=-1..1,colour=black);

 >

 >

 >

 >

 >