> restart;

> f5:= x -> Sum((8/(n*n*Pi*Pi)*sin(n/2*Pi)-4/(n*Pi)*cos(n*Pi))*sin(n*Pi/2*x),n=1..5);

> g5:= x -> 3/2+Sum(8/(n*n*Pi*Pi)*(cos(n/2*Pi)-1)*cos(n*Pi/2*x),n=1..5);

> h:= x-> piecewise(0<x and x<1,2*x,1<x and x < 2, 2);

> plot(h(x), x=0..2, title="Example 1: odd-even", color = black);

> plot([h(x),f5(x)], x=0..2, title="Ex 1, odd-even sin-series f5", color=[black,black]);

> plot([h(x), g5(x)], x=0..2, title = "Ex 1, odd-even cos-series g5", color=[black,black]);

> f50:= x -> Sum((8/(n*n*Pi*Pi)*sin(n/2*Pi)-4/(n*Pi)*cos(n*Pi))*sin(n*Pi/2*x),n=1..50);

> g50:= x -> 3/2+Sum(8/(n*n*Pi*Pi)*(cos(n/2*Pi)-1)*cos(n*Pi/2*x),n=1..50);

> plot([h(x),f50(x)], x=0..2, title="Ex 1, odd-even sin-series f50", color=[black,black]);

> plot([h(x), g50(x)], x=0..2, title = "Ex 1, odd-even cos-series g50", color=[black,black]);

> plot([f50(x), g50(x)], x=0..2, title = "Ex 1, odd-even sin-serie f50 and cos-series g50", color=[black,blue]);

> plot([f50(x), g50(x)], x=-4..4, title = "Ex 1, odd-even sin-serie f50 and cos-series g50", color=[black,blue]);

>