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

global xi p q ab ab0 
m=ceil((n+1)/2)+p+q; xi2=xi^2;
U=zeros(n);
abn=ab(1:n,:); 
xwn=gauss(n,abn); xn=xwn(:,1);
ab0m=ab0(1:m,:);
xw0m=gauss(m,ab0m); x0m=xw0m(:,1); w0m=xw0m(:,2);
for k=1:n
  for j=1:n
    xj=xn(j);
    if xj<-xi
      s=0;
      for i=1:m
        x=((1+xj)/2)*x0m(i)+(xj-1)/2;
        lag=lagrange(n,xn,x);
        s=s+w0m(i)*lag(k)*x*(x^2-xi2)^p*(1-x^2)^q;
      end
      U(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,xn,x);
        s=s+w0m(i)*lag(k)*x*(x^2-xi2)^p*(1-x^2)^q;
      end
      U(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,xn,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,xn,x);
        s=s+w0m(i)*lag(k)*x*(x^2-xi2)^p*(1-x^2)^q;
      end
      s=((xj-xi)/2)*s;
      U(j,k)=s0+s;
    end
  end
end
digits(dig);
U=vpa(U);
d=eig(U);
d=double(d);
U=double(U);
