# Asmar 2.3-7, plot details Fourier series arbitrary period pulse:=(x,a,b)->piecewise(x(1-x)*pulse(x,0,2)+(-1-x)*pulse(x,-2,0); #plot(f(x),x=0..1); # Define periodic extension F using the square wave sw1:=x->x-floor(x+1/2); F:=x->f(4*sw1(x/4)); plot(F(x),x=-1..4,discont=true); # Define periodic extension F1 with recursion F1 := proc (x) if x > 2 then thisproc(x-2) else if x < -2 then thisproc(x+2) else f(x); end if end if end proc: F(3.1),F(4),F(-4.2);F1(3.1),F1(4),F1(-4.2); plot('F1(x)',x=-1..4,discont=true);