%COUNTEREX1

U=zeros(5);
ab=r_jacobi(3); xw=gauss(3,ab); 
x=xw(:,1); w=xw(:,2); %3-point Gauss-Legendre nodes 
%  and weights
p=[187 -68 4]; %Gegenbauer polynomial C_5(x) of degree 5
%  divided by x as a function of x^2 (up to a constant 
%  factor) with parameter alpha=39/4
z=roots(p); sqz=sqrt(z);
r=[-sqz(1);-sqz(2);0;sqz(2);sqz(1)] %zeros of the 
%  Gegenbauer polynomial
%  The matrix U
for j=1:5
  for k=1:5
    s=0;
%   Gauss quadrature of elementary Lagrange polynomials
    for i=1:3
      xtemp=.5*(1+r(j))*x(i)-.5*(1-r(j));
      lag=lagrange(5,r,xtemp);
      s=s+w(i)*lag(k);     
    end
    U(j,k)=.5*(1+r(j))*s;
  end
end
%  eigenvalues of U
d=eig(U)
