function g = psums(n,p)
% This function accepts a positive integer n and a positive real number
% p as inputs. It computes the partial sums S_1, S_2, ... ,S_n of
% of the p-series and plots points (k,S_k) and (k,exp(S_k)) so that
% one can play and see that the convergence gets slower and slower as
% p gets closer and closer to 1 and breaks down completely when p=1.
f=@(x)1./(x.^p);
x=linspace(1,n,n);
z=cumsum(f(x));
w=exp(z);
subplot(2,1,1), plot(x,z)
subplot(2,1,2), plot(x,w)