function [ x, w ] = legendre_set_x0_01 ( n )

%*****************************************************************************80
%
%% legendre_set_x0_01() sets a Gauss-Legendre rule for F(X) on [0,1].
%
%  Discussion:
%
%    The integral:
%
%      Integral ( 0 <= X <= 1 ) F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 October 2005
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Abramowitz, Stegun,
%    Handbook of Mathematical Functions,
%    National Bureau of Standards, 1964, page 921.
%
%  Input:
%
%    integer N, the order.
%    N must be between 1 and 8.
%
%  Output:
%
%    real X(N), the abscissas.
%
%    real W(N), the weights.
%
  x = zeros ( n, 1 );
  w = zeros ( n, 1 );

  if ( n == 1 )

    x(1) =   0.5;

    w(1) = 1.0;

  elseif ( n == 2 )

    x(1) = 0.2113248654;
    x(2) = 0.7886751346;

    w(1) = 0.5;
    w(2) = 0.5;

  elseif ( n == 3 )

    x(1) = 0.1127016654;
    x(2) = 0.5000000000;
    x(3) = 0.8872983346;

    w(1) = 5.0 / 18.0;
    w(2) = 8.0 / 18.0;
    w(3) = 5.0 / 18.0;

  elseif ( n == 4 )

    x(1) = 0.0694318442;
    x(2) = 0.3300094782;
    x(3) = 0.6699905218;
    x(4) = 0.9305681558;

    w(1) = 0.1739274226;
    w(2) = 0.3260725774;
    w(3) = 0.3260725774;
    w(4) = 0.1739274226;

  elseif ( n == 5 )

    x(1) = 0.0469100770;
    x(2) = 0.2307653449;
    x(3) = 0.5000000000;
    x(4) = 0.7692346551;
    x(5) = 0.9530899230;

    w(1) = 0.1184634425;
    w(2) = 0.2393143352;
    w(3) = 0.2844444444;
    w(4) = 0.2393143352;
    w(5) = 0.1184634425;

  elseif ( n == 6 )

    x(1) = 0.0337652429;
    x(2) = 0.1693953068;
    x(3) = 0.3806904070;
    x(4) = 0.6193095930;
    x(5) = 0.8306046932;
    x(6) = 0.9662347571;

    w(1) = 0.0856622462;
    w(2) = 0.1803807865;
    w(3) = 0.2339569673;
    w(4) = 0.2339569673;
    w(5) = 0.1803807865;
    w(6) = 0.0856622462;

  elseif ( n == 7 )

    x(1) = 0.0254460438;
    x(2) = 0.1292344072;
    x(3) = 0.2970774243;
    x(4) = 0.5000000000;
    x(5) = 0.7029225757;
    x(6) = 0.8707655928;
    x(7) = 0.9745539562;

    w(1) = 0.0647424831;
    w(2) = 0.1398526957;
    w(3) = 0.1909150253;
    w(4) = 0.2089795918;
    w(5) = 0.1909150253;
    w(6) = 0.1398526957;
    w(7) = 0.0647424831;

  elseif ( n == 8 )

    x(1) = 0.0198550718;
    x(2) = 0.1016667613;
    x(3) = 0.2372337950;
    x(4) = 0.4082826788;
    x(5) = 0.5917173212;
    x(6) = 0.7627662050;
    x(7) = 0.8983332387;
    x(8) = 0.9801449282;

    w(1) = 0.0506142681;
    w(2) = 0.1111905172;
    w(3) = 0.1568533229;
    w(4) = 0.1813418917;
    w(5) = 0.1813418917;
    w(6) = 0.1568533229;
    w(7) = 0.1111905172;
    w(8) = 0.0506142681;

  else

    fprintf ( 1, '\n' );
    fprintf ( 1, 'LEGENDRE_SET_X0_01 - Fatal error!\n' );
    fprintf ( 1, '  Illegal value of N = %d\n', n );
    error ( 'LEGENDRE_SET_X0_01 - Fatal error!' );

  end

  return
end
