Some examples of Fourier series

%?

> tr:=x-> if (x>=(-4) and x<(-2)) then (x+4) elif (x>=-2 and x<0) then -x elif (x>=0 and x<2) then x elif (x>=2 and x<4) then -(x-4) fi;

tr := proc (x) options operator, arrow; if -4 <= x ...
tr := proc (x) options operator, arrow; if -4 <= x ...
tr := proc (x) options operator, arrow; if -4 <= x ...
tr := proc (x) options operator, arrow; if -4 <= x ...

1

> plot(tr,-3..3);

[Maple Plot]

>

> sq:=proc(x) if (x>=(-2*evalf(Pi)) and x<(-1*evalf(Pi))) then 1 elif (x>=-1*evalf(Pi) and x<0) then -1 elif (x>=0 and x<evalf(Pi)) then 1 elif (x>=evalf(Pi) and x<2*evalf(Pi)) then -1 end if end proc;

sq := proc (x) if -2*evalf(Pi) <= x and x < -evalf(...
sq := proc (x) if -2*evalf(Pi) <= x and x < -evalf(...
sq := proc (x) if -2*evalf(Pi) <= x and x < -evalf(...
sq := proc (x) if -2*evalf(Pi) <= x and x < -evalf(...
sq := proc (x) if -2*evalf(Pi) <= x and x < -evalf(...
sq := proc (x) if -2*evalf(Pi) <= x and x < -evalf(...
sq := proc (x) if -2*evalf(Pi) <= x and x < -evalf(...

>

-1

> plot(sq,-5..5);

>

[Maple Plot]

> f:=(x,n)->1-8/(Pi^2)*sum('cos((2*k-1)*Pi*x/2)/(2*k-1)^2',k=1..n);

f := proc (x, n) options operator, arrow; 1-8*sum('...

> f5:=x->f(x,5);

f5 := proc (x) options operator, arrow; f(x,5) end ...

> plot([tr,f5],-3..3);

[Maple Plot]

> plot(tr-f5,-3..3);

[Maple Plot]

> plot(tr-f2,-3..3);

[Maple Plot]

> g:=(x,n)->(4/Pi)*sum('sin((2*k-1)*x)/(2*k-1)',k=1..n);

g := proc (x, n) options operator, arrow; 4*sum('si...

> g2:=x->g(x,2);

g2 := proc (x) options operator, arrow; g(x,2) end ...

> g5:=x->g(x,5);

g5 := proc (x) options operator, arrow; g(x,5) end ...

> plot([sq,g2,g5],-5..5);

[Maple Plot]

> plot([sq-g2,sq-g5],-5..5);

[Maple Plot]

> plot(sq-g2,-5..5);

[Maple Plot]

> plot(sq-g5,-5..5);

[Maple Plot]

>