function SumC=FpexRlxKIntCos(x,n,del) % sumC for FPEX relaxation wth IC DEP k=2n={2,4,6,8,10,..} % indefinte integral to X (x^-2n)*cos(del*x) dx del=m*pi/(b-a) % n-2 sum D.Bakewell 16:20 Mo/9/8/1999 format long; n2sumS=0; n1sumC=0; nsi=0; n2term=0; if n>=2; for jc=1:1:n-1; % actually j=0:1:n-2 j=jc-1; n2term=n2term+((-1)^j)*gamma(2*j+2)/((del*x)^(2*j+1)); end n2sumS=-sin(del*x)*n2term*(del^(2*n-1))*((-1)^(n-1))/(del*x*gamma(2*n)); elseif n<2; n2sumS=0; end % n-1 sum n1term=0; if n>=1 for jc=1:1:n; % actually j=0:1:n-1 j=jc-1; n1term=n1term+((-1)^(j+1))*gamma(2*j+1)/((del*x)^(2*j)); end n1sumC=cos(del*x)*n1term*(del^(2*n-1))*((-1)^(n-1))/(del*x*gamma(2*n)); elseif n==0 n1sumC=0 end % NOTE: i=sqrt(-1) nsi=-imag(expint(i*del*x))*(del^(2*n-1))*((-1)^(n+1))/gamma(2*n); n2sumS; n1sumC; nsi; SumC=n2sumS+n1sumC+nsi;