>    periodic:= (x,a,b) -> x -(b-a)*floor((x-a)/(b-a));

periodic := proc (x, a, b) options operator, arrow; x-(b-a)*floor((x-a)/(b-a)) end proc

>    sawtooth:=x->periodic((Pi-x)/2,-Pi/2,Pi/2);

sawtooth := proc (x) options operator, arrow; periodic(1/2*Pi-1/2*x,-1/2*Pi,1/2*Pi) end proc

>    plot(sawtooth,-5..10);

[Maple Plot]

>    fourier:= (x,M) -> sum(sin(n*x)/n,n=1..M);

fourier := proc (x, M) options operator, arrow; sum(sin(n*x)/n,n = 1 .. M) end proc

>    plot([seq(fourier(x,N),N=1..6)],x=-5..10);

[Maple Plot]

>    plot([seq(fourier(x,N),N=1..20)],x=-5..10);

[Maple Plot]

>    plot(fourier(x,20),x=-5..10);

[Maple Plot]

>