  function [w,x] = GLWeights(m)
% [w,x] = GLWeights(m)
%
% w is a column m-vector consisting of the weights for the m-point
%  Gauss-Legendre rule.
% x is a column m-vector consisting of the abscissae.
% m is an integer that satisfies 2 <= m <= 6.

w = ones(m,1); x = ones(m,1);

switch m
case 1
case 2
   x(1)   = -0.577350269189626;
case 3
   w(1:2) = [5/9
             8/9              ];
   x(1:2) =[-0.774596669241483
             0                ];
case 4
   w(1:2) = [0.347854845137454
             0.652145154862546];
   x(1:2) =[-0.861136311594053
            -0.339981043584856];
case 5
   w(1:3) = [0.236926885056189
             0.478628670499366
             0.568888888888889];
   x(1:3) =[-0.906179845938644
            -0.538469310105683
             0                ];
case 6
   w(1:3) = [0.171324492379170
             0.360761573048139
             0.467913934572691];
   x(1:3) =[-0.932469514203152
            -0.661209386466265
            -0.238619186083197];
otherwise
   error('Sorry, I only know the m-point Gauss-Legendre rules for m=1:6.')
end

mo2 = 1:m/2;
x(m+1-mo2) = -x(mo2); w(m+1-mo2) =  w(mo2);


