kill(all);

M:10;

sinc(x):=limit(sin(t)/t,t,%pi*x);

define(dd(t) , 1/2/%pi + 1/%pi*sum(  cos(n*t) , n,1,M));

define(
    dds(t) , 
    expand(
        1/2/%pi + 1/%pi*sum( sinc(i/M)* cos(i*t) , i,1,M)
    )
);

wxplot2d([dd(t),dds(t)],[t,-%pi,%pi]);

integrate(dd(t),t,-%pi,%pi);

integrate(dds(t),t,-%pi,%pi);

expand(dds(t)+dds(t-%pi));

expand(dd(t)+dd(t-%pi));