% SCHALLEPS Symbolic counterpart of challeps.m
%
syms spi ss ssa U sgn a
tic
dig=68;
spi=vpa(pi,dig);
n=87; M1=80; M2=57;
ss=zeros(n,1); ssa=zeros((n+1)/2,1);
ss=vpa(ss,dig); ssa=vpa(ssa,dig);
ab0=sr_jacobi01(dig,M1);
ab=sr_jacobi(dig,M2);
U=zeros(M1,1);
U=vpa(U,dig);
xw=sgauss(dig,M1,ab0);
xw=spi*xw/2;  
for i=1:M1
  U(i)=suofx(dig,xw(i,1));
end
ss(1)=sum(xw(:,2).*cos(xw(:,1))./(xw(:,1)+U));
sgn=vpa(1,dig);
xw=sgauss(dig,M2,ab);
xw=spi*xw/2;
for k=1:n
  if k>=2, ss(k)=ss(k-1)+sgn*a; end
  U=zeros(M2,1);
  U=vpa(U,dig);
  for i=1:M2
    U(i)=suofx(dig,xw(i,1)+k*spi);
  end
  a=sum(xw(:,2).*cos(xw(:,1))./(xw(:,1)+U+k*spi));
  sgn=-sgn;
end
E=sepsalg(dig,n,ss);
for i=1:(n+1)/2
  ssa(i)=vpa(E(n-2*i+2,2*i),dig);
end
time=toc
sa=vpa(ssa,dig)
