  function w = gl_weight ( n );
%
%  function w = gl_weight ( n )
%
%  For 1 <= N <= 10, returns the weights W of an
%  N point Gauss-Legendre quadrature rule over the interval [-1,1].
%
%  For use on an interval [A,B], multiply the weights by ( B - A ) / 2.
%
%  Since we're used to ROW vectors, W will be returned as a row vector.
%
  w = ones(1,n); 

  if ( n == 1 ) 
    w(1) = 2.0;
  elseif ( n == 2 )
    w(1) =  1.0; 
    w(2) =  w(1);
  elseif ( n == 3 )
    w(1) =  5 / 9; 
    w(2) =  8 / 9;
    w(3) =  5 / 9;
  elseif ( n == 4 )
    w(1) = 0.347854845137453857373063949222;
    w(2) = 0.652145154862546142626936050778;
    w(3) = 0.652145154862546142626936050778;
    w(4) = 0.347854845137453857373063949222;
  elseif ( n == 5 )
    w(1) = 0.236926885056189087514264040720;
    w(2) = 0.478628670499366468041291514836;
    w(3) = 0.568888888888888888888888888889;
    w(4) = 0.478628670499366468041291514836;
    w(5) = 0.236926885056189087514264040720;
  elseif ( n == 6 ) 
    w(1) = 0.171324492379170345040296142173;
    w(2) = 0.360761573048138607569833513838;
    w(3) = 0.467913934572691047389870343990;
    w(4) = 0.467913934572691047389870343990;
    w(5) = 0.360761573048138607569833513838;
    w(6) = 0.171324492379170345040296142173;
  elseif ( n == 7 ) 
    w(1) = 0.129484966168869693270611432679;
    w(2) = 0.279705391489276667901467771424;
    w(3) = 0.381830050505118944950369775489;
    w(4) = 0.417959183673469387755102040816;
    w(5) = 0.381830050505118944950369775489;
    w(6) = 0.279705391489276667901467771424;
    w(7) = 0.129484966168869693270611432679;
  elseif ( n == 8 )
    w(1) = 0.101228536290376259152531354310;
    w(2) = 0.222381034453374470544355994426;
    w(3) = 0.313706645877887287337962201987;
    w(4) = 0.362683783378361982965150449277;
    w(5) = 0.362683783378361982965150449277;
    w(6) = 0.313706645877887287337962201987;
    w(7) = 0.222381034453374470544355994426;
    w(8) = 0.101228536290376259152531354310;
  elseif ( n == 9 )
    w(1) = 0.0812743883615744119718921581105;
    w(2) = 0.180648160694857404058472031243;
    w(3) = 0.260610696402935462318742869419;
    w(4) = 0.312347077040002840068630406584;
    w(5) = 0.330239355001259763164525069287;
    w(6) = 0.312347077040002840068630406584;
    w(7) = 0.260610696402935462318742869419;
    w(8) = 0.180648160694857404058472031243;
    w(9) = 0.0812743883615744119718921581105;
  elseif ( n == 10 )
    w(1) =  0.0666713443086881375935688098933;
    w(2) =  0.149451349150580593145776339658;
    w(3) =  0.219086362515982043995534934228;
    w(4) =  0.269266719309996355091226921569;
    w(5) =  0.295524224714752870173892994651;
    w(6) =  0.295524224714752870173892994651;
    w(7) =  0.269266719309996355091226921569;
    w(8) =  0.219086362515982043995534934228;
    w(9) =  0.149451349150580593145776339658;
    w(10) = 0.0666713443086881375935688098933;
  else

    ' '
    'GL_RULE - Fatal error!'
    '  Illegal value of N.'
 
  end;


