function [U,d]=Uconj_twoint(dig,n)
%UCONJ_TWOINT The Stenger conjecture.  
%   Tests the validity of the Stenger U-onjecture for
%   a weight function supported on two symmetric intervals

global xi p q ab0 ab1 
m=ceil((n+1)/2)+p+q; xi2=xi^2;
C=zeros(n);
ab1n=ab1(1:n,:); 
xw1n=gauss(n,ab1n); x1n=xw1n(:,1);
ab0m=ab0(1:m,:);
xw0m=gauss(m,ab0m); x0m=xw0m(:,1); w0m=xw0m(:,2);
for k=1:n
  for j=1:n
    xj=x1n(j);
    if xj<-xi
      s=0;
      for i=1:m
        x=((1+xj)/2)*x0m(i)+(xj-1)/2;
        lag=lagrange(n,x1n,x);
        s=s-w0m(i)*lag(k)*x*(x^2-xi2)^p*(1-x^2)^q;
      end
      C(j,k)=((1+xj)/2)*s;
    elseif abs(xj)<xi
      s=0;
      for i=1:m
        x=((1-xi)/2)*x0m(i)-(1+xi)/2;
        lag=lagrange(n,x1n,x);
        s=s-w0m(i)*lag(k)*x*(x^2-xi2)^p*(1-x^2)^q;
      end
      C(j,k)=((1-xi)/2)*s;
    else
      s0=0;
      for i=1:m
        x=((1-xi)/2)*x0m(i)-(1+xi)/2;
        lag=lagrange(n,x1n,x);
        s0=s0-w0m(i)*lag(k)*x*(x^2-xi2)^p*(1-x^2)^q;
      end
      s0=((1-xi)/2)*s0;
      s=0;
      for i=1:m
        x=((xj-xi)/2)*x0m(i)+(xj+xi)/2;
        lag=lagrange(n,x1n,x);
        s=s+w0m(i)*lag(k)*x*(x^2-xi2)^p*(1-x^2)^q;
      end
      s=((xj-xi)/2)*s;
      C(j,k)=s0+s;
    end
  end
end
if n==5
  for k=1:n
    PS=prestable(C,k);
  end
  disp('U is prestable for n=5')
end
digits(dig);
U=vpa(C);
d=eig(U);
d=double(d);
U=double(U);
