function [y,t]=part_sum(fun, nth_sum,interval)
n=nth_sum;
if nargin==3,
low=interval(1);
high=interval(2);
else 
low=0;
high=2*pi;
end
t=linspace(low,high,1024);
vals_fun=feval(fun,t);
hat_vals=fft(vals_fun);
a=[hat_vals(1)/1024,real(hat_vals(2:end))/512];
b=-imag(hat_vals(2:end))/512;
[C,S]=trig_val(1:n,t);
y=a(1:(n+1))*C + b(1:n)*S;
