> # CESARO SUMMATION OF A SQUARE WAVE

>

> bodd := k -> (4/Pi)*(1/(2*k+1));

bodd := proc (k) options operator, arrow; 4*1/(Pi*(...

> partialsum := K -> sum(bodd(k)*sin((2*k+1)*x), k=0..K);

partialsum := proc (K) options operator, arrow; sum...

> mean := M -> (1/(M+1))*sum(partialsum(K), K=0..M);

mean := proc (M) options operator, arrow; sum(parti...

> plot([partialsum(1), mean(1)], x=-1..4);

[Maple Plot]

> plot([partialsum(2), mean(2)], x=-1..4);

[Maple Plot]

> # Qualitatively, the Cesaro mean looks more like a square wave than the partial sum does.

> # Notice, however, that the Cesaro approximation is NUMERICALLY WORSE close to the discontinuity.

>

> plot([partialsum(8), mean(8)], x=-1..4);

[Maple Plot]

> # REMARK: What we're doing is not the smartest way to organize the calculation from the point of view of minimizing computer time. We are calculating the same partial sums over and over again.

>

> plot([partialsum(16), mean(16)], x=-1..4);

[Maple Plot]

> plot([partialsum(32), mean(32)], x=-1..4);

[Maple Plot]

> plot([partialsum(64), mean(64)], x=-1..4);

[Maple Plot]

> plot([partialsum(128), mean(128)], x=-1..4);

[Maple Plot]

>

>