function [ x, w ] = legendre_set_x1 ( n )

%*****************************************************************************80
%
%% legendre_set_x1() sets a Gauss-Legendre rule for ( 1 + X ) * F(X) on [-1,1].
%
%  Discussion:
%
%    The integral:
%
%      Integral ( -1 <= X <= 1 ) ( 1 + X ) * 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:
%
%    13 October 2005
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Input:
%
%    integer N, the order.
%    N must be between 1 and 9.
%
%  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.333333333333333333333333333333;

    w(1) = 2.0;

  elseif ( n == 2 )

    x(1) = -0.289897948556635619639456814941;
    x(2) =  0.689897948556635619639456814941;

    w(1) =  0.727834473024091322422523991699;
    w(2) =  1.27216552697590867757747600830;

  elseif ( n == 3 )

    x(1) = -0.575318923521694112050483779752;
    x(2) =  0.181066271118530578270147495862;
    x(3) =  0.822824080974592105208907712461;

    w(1) =  0.279307919605816490135525088716;
    w(2) =  0.916964425438344986775682378225;
    w(3) =  0.803727654955838523088792533058;

  elseif ( n == 4 )

    x(1) = -0.720480271312438895695825837750;
    x(2) = -0.167180864737833640113395337326;
    x(3) =  0.446313972723752344639908004629;
    x(4) =  0.885791607770964635613757614892;

    w(1) =  0.124723883800032328695500588386;
    w(2) =  0.519390190432929763305824811559;
    w(3) =  0.813858272041085443165617903743;
    w(4) =  0.542027653725952464833056696312;

  elseif ( n == 5 )

    x(1) = -0.802929828402347147753002204224;
    x(2) = -0.390928546707272189029229647442;
    x(3) =  0.124050379505227711989974959990;
    x(4) =  0.603973164252783654928415726409;
    x(5) =  0.920380285897062515318386619813;

    w(1) =  0.0629916580867691047411692662740;
    w(2) =  0.295635480290466681402532877367;
    w(3) =  0.585547948338679234792151477424;
    w(4) =  0.668698552377478261966702492391;
    w(5) =  0.387126360906606717097443886545;

  elseif ( n == 6 )

    x(1) = -0.853891342639482229703747931639;
    x(2) = -0.538467724060109001833766720231;
    x(3) = -0.117343037543100264162786683611;
    x(4) =  0.326030619437691401805894055838;
    x(5) =  0.703842800663031416300046295008;
    x(6) =  0.941367145680430216055899446174;

    w(1) =  0.0349532072544381270240692132496;
    w(2) =  0.175820662202035902032706497222;
    w(3) =  0.394644603562621056482338042193;
    w(4) =  0.563170215152795712476307356284;
    w(5) =  0.542169988926074467362761586552;
    w(6) =  0.289241322902034734621817304499;

  elseif ( n == 7 )

    x(1) = -0.887474878926155707068695617935;
    x(2) = -0.639518616526215270024840114382;
    x(3) = -0.294750565773660725252184459658;
    x(4) =  0.0943072526611107660028971153047;
    x(5) =  0.468420354430821063046421216613;
    x(6) =  0.770641893678191536180719525865;
    x(7) =  0.955041227122575003782349000858;

    w(1) =  0.0208574488112296163587654972151;
    w(2) =  0.109633426887493901777324193433;
    w(3) =  0.265538785861965879934591955055;
    w(4) =  0.428500262783494679963649011999;
    w(5) =  0.509563589198353307674937943100;
    w(6) =  0.442037032763498409684482945478;
    w(7) =  0.223869453693964204606248453720;

  elseif ( n == 8 )

    x(1) = -0.910732089420060298533757956283;
    x(2) = -0.711267485915708857029562959544;
    x(3) = -0.426350485711138962102627520502;
    x(4) = -0.0903733696068532980645444599064;
    x(5) =  0.256135670833455395138292079035;
    x(6) =  0.571383041208738483284917464837;
    x(7) =  0.817352784200412087992517083851;
    x(8) =  0.964440169705273096373589797925;

    w(1) =  0.0131807657689951954189692640444;
    w(2) =  0.0713716106239448335742111888042;
    w(3) =  0.181757278018795592332221684383;
    w(4) =  0.316798397969276640481632757440;
    w(5) =  0.424189437743720042818124385645;
    w(6) =  0.450023197883549464687088394417;
    w(7) =  0.364476094545494505382889847132;
    w(8) =  0.178203217446223725304862478136;

  elseif ( n == 9 )

    x(1) = -0.927484374233581078117671398464;
    x(2) = -0.763842042420002599615429776011;
    x(3) = -0.525646030370079229365386614293;
    x(4) = -0.236234469390588049278459503207;
    x(5) =  0.0760591978379781302337137826389;
    x(6) =  0.380664840144724365880759065541;
    x(7) =  0.647766687674009436273648507855;
    x(8) =  0.851225220581607910728163628088;
    x(9) =  0.971175180702246902734346518378;

    w(1) =  0.00872338834309252349019620448007;
    w(2) =  0.0482400171391415162069086091476;
    w(3) =  0.127219285964216005046760427743;
    w(4) =  0.233604781180660442262926091607;
    w(5) =  0.337433287379681397577000079834;
    w(6) =  0.401235236773473158616600898930;
    w(7) =  0.394134968689382820640692081477;
    w(8) =  0.304297020437232650320317215016;
    w(9) =  0.145112014093119485838598391765;

  else

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

  end

  return
end
