function [ x, w ] = hermite_set ( n )

%*****************************************************************************80
%
%% HERMITE_SET sets abscissas and weights for Hermite quadrature.
%
%  Discussion:
%
%    The integral:
%
%      integral ( -oo < x < +oo ) f(x) * rho(x) dx
%
%    The weight:
%
%      rho(x) = exp ( - x * x )
%
%    The quadrature rule:
%
%      sum ( 1 <= i <= n ) w(i) * f ( x(i) ).
%
%    Mathematica can numerically estimate the abscissas of the rule
%    of order N to P digits by the command:
%
%      NSolve [ HermiteH [ n, x ] == 0, x, p ]
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    24 April 2010
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Milton Abramowitz, Irene Stegun,
%    Handbook of Mathematical Functions,
%    National Bureau of Standards, 1964,
%    ISBN: 0-486-61272-4,
%    LC: QA47.A34.
%
%    Vladimir Krylov,
%    Approximate Calculation of Integrals,
%    Dover, 2006,
%    ISBN: 0486445798,
%    LC: QA311.K713.
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%    Stephen Wolfram,
%    The Mathematica Book,
%    Fourth Edition,
%    Cambridge University Press, 1999,
%    ISBN: 0-521-64314-7,
%    LC: QA76.95.W65
%
%    Daniel Zwillinger, editor,
%    CRC Standard Mathematical Tables and Formulae,
%    30th Edition,
%    CRC Press, 1996,
%    ISBN: 0-8493-2479-3,
%    LC: QA47.M315.
%
%  Parameters:
%
%    Input, integer N, the order.
%    N must be between 1 and 10.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  x = zeros ( n, 1 );
  w = zeros ( n, 1 );

  if ( n == 1 )

    x(1) = 0.0;

    w(1) = 1.77245385090551602729816748334;

  elseif ( n == 2 )

    x(1) = - 0.707106781186547524400844362105;
    x(2) =   0.707106781186547524400844362105;

    w(1) = 0.886226925452758013649083741671;
    w(2) = 0.886226925452758013649083741671;

  elseif ( n == 3 )

    x(1) = - 0.122474487139158904909864203735E+01;
    x(2) =   0.0;
    x(3) =   0.122474487139158904909864203735E+01;

    w(1) = 0.295408975150919337883027913890;
    w(2) = 0.118163590060367735153211165556E+01;
    w(3) = 0.295408975150919337883027913890;

  elseif ( n == 4 )

    x(1) = - 0.165068012388578455588334111112E+01;
    x(2) = - 0.524647623275290317884060253835;
    x(3) =   0.524647623275290317884060253835;
    x(4) =   0.165068012388578455588334111112E+01;

    w(1) = 0.813128354472451771430345571899E-01;
    w(2) = 0.804914090005512836506049184481;
    w(3) = 0.804914090005512836506049184481;
    w(4) = 0.813128354472451771430345571899E-01;

  elseif ( n == 5 )

    x(1) = - 0.202018287045608563292872408814E+01;
    x(2) = - 0.958572464613818507112770593893;
    x(3) =   0.0;
    x(4) =   0.958572464613818507112770593893;
    x(5) =   0.202018287045608563292872408814E+01;

    w(1) = 0.199532420590459132077434585942E-01;
    w(2) = 0.393619323152241159828495620852;
    w(3) = 0.945308720482941881225689324449;
    w(4) = 0.393619323152241159828495620852;
    w(5) = 0.199532420590459132077434585942E-01;

  elseif ( n == 6 )

    x(1) = - 0.235060497367449222283392198706E+01;
    x(2) = - 0.133584907401369694971489528297E+01;
    x(3) = - 0.436077411927616508679215948251;
    x(4) =   0.436077411927616508679215948251;
    x(5) =   0.133584907401369694971489528297E+01;
    x(6) =   0.235060497367449222283392198706E+01;

    w(1) = 0.453000990550884564085747256463E-02;
    w(2) = 0.157067320322856643916311563508;
    w(3) = 0.724629595224392524091914705598;
    w(4) = 0.724629595224392524091914705598;
    w(5) = 0.157067320322856643916311563508;
    w(6) = 0.453000990550884564085747256463E-02;

  elseif ( n == 7 )

    x(1) = - 0.265196135683523349244708200652E+01;
    x(2) = - 0.167355162876747144503180139830E+01;
    x(3) = - 0.816287882858964663038710959027;
    x(4) =   0.0;
    x(5) =   0.816287882858964663038710959027;
    x(6) =   0.167355162876747144503180139830E+01;
    x(7) =   0.265196135683523349244708200652E+01;

    w(1) = 0.971781245099519154149424255939E-03;
    w(2) = 0.545155828191270305921785688417E-01;
    w(3) = 0.425607252610127800520317466666;
    w(4) = 0.810264617556807326764876563813;
    w(5) = 0.425607252610127800520317466666;
    w(6) = 0.545155828191270305921785688417E-01;
    w(7) = 0.971781245099519154149424255939E-03;

  elseif ( n == 8 )

    x(1) = - 0.293063742025724401922350270524E+01;
    x(2) = - 0.198165675669584292585463063977E+01;
    x(3) = - 0.115719371244678019472076577906E+01;
    x(4) = - 0.381186990207322116854718885584;
    x(5) =   0.381186990207322116854718885584;
    x(6) =   0.115719371244678019472076577906E+01;
    x(7) =   0.198165675669584292585463063977E+01;
    x(8) =   0.293063742025724401922350270524E+01;

    w(1) = 0.199604072211367619206090452544E-03;
    w(2) = 0.170779830074134754562030564364E-01;
    w(3) = 0.207802325814891879543258620286;
    w(4) = 0.661147012558241291030415974496;
    w(5) = 0.661147012558241291030415974496;
    w(6) = 0.207802325814891879543258620286;
    w(7) = 0.170779830074134754562030564364E-01;
    w(8) = 0.199604072211367619206090452544E-03;

  elseif ( n == 9 )

    x(1) = - 0.319099320178152760723004779538E+01;
    x(2) = - 0.226658058453184311180209693284E+01;
    x(3) = - 0.146855328921666793166701573925E+01;
    x(4) = - 0.723551018752837573322639864579;
    x(5) =   0.0;
    x(6) =   0.723551018752837573322639864579;
    x(7) =   0.146855328921666793166701573925E+01;
    x(8) =   0.226658058453184311180209693284E+01;
    x(9) =   0.319099320178152760723004779538E+01;

    w(1) = 0.396069772632643819045862946425E-04;
    w(2) = 0.494362427553694721722456597763E-02;
    w(3) = 0.884745273943765732879751147476E-01;
    w(4) = 0.432651559002555750199812112956;
    w(5) = 0.720235215606050957124334723389;
    w(6) = 0.432651559002555750199812112956;
    w(7) = 0.884745273943765732879751147476E-01;
    w(8) = 0.494362427553694721722456597763E-02;
    w(9) = 0.396069772632643819045862946425E-04;

  elseif ( n == 10 )

    x(1) =  - 0.343615911883773760332672549432E+01;
    x(2) =  - 0.253273167423278979640896079775E+01;
    x(3) =  - 0.175668364929988177345140122011E+01;
    x(4) =  - 0.103661082978951365417749191676E+01;
    x(5) =  - 0.342901327223704608789165025557;
    x(6) =    0.342901327223704608789165025557;
    x(7) =    0.103661082978951365417749191676E+01;
    x(8) =    0.175668364929988177345140122011E+01;
    x(9) =    0.253273167423278979640896079775E+01;
    x(10) =   0.343615911883773760332672549432E+01;

    w(1) =  0.764043285523262062915936785960E-05;
    w(2) =  0.134364574678123269220156558585E-02;
    w(3) =  0.338743944554810631361647312776E-01;
    w(4) =  0.240138611082314686416523295006;
    w(5) =  0.610862633735325798783564990433;
    w(6) =  0.610862633735325798783564990433;
    w(7) =  0.240138611082314686416523295006;
    w(8) =  0.338743944554810631361647312776E-01;
    w(9) =  0.134364574678123269220156558585E-02;
    w(10) = 0.764043285523262062915936785960E-05;
    
  else

    fprintf ( 1, '\n' );
    fprintf ( 1, 'HERMITE_SET - Fatal error!\n' );
    fprintf ( 1, '  Illegal value of N = %d\n', n );
    fprintf ( 1, '  Legal values are 1 to 10.\n' );
    error ( 'HERMITE_SET - Fatal error!' );

  end

  return
end
