function [x,w]=GaussByGolubWelschBruteForce(n);
% GAUSSBYGOLUBWELSCHBRUTEFORCE Golub-Welsch brute force implementation
%   [x,w]=GaussByGolubWelschBruteForce(n); computes the n nodes and
%   weights for Gauss Legendre quadrature for the interval (a,b) using
%   the idea of Golub-Welsch, but in a brute force implementation.

beta=0.5./sqrt(1-(2*(1:n-1)).^(-2));
[Q,D]=eig(diag(beta,1)+diag(beta,-1));
[x,i]=sort(diag(D)); w=2*Q(1,i).^2';