%
%  diverg.m -- djm, 20 june 05
%

x = -pi:pi/512/16:pi;
k = 2;

y = 0;
for jj = 1:2^(k^3)
   y = y + sin(jj*x)/jj;
end

y = 2*sin(2^(k^3 + 1) * x) .* y;

figure(3);  clf
subplot(2,1,1)
plot(x,y)
subplot(2,1,2);  hold on
plot(x,y,'r')
plot(x,y,'k.')
