function tensor_grid_display ( m, n_1d, rule )

%*****************************************************************************80
%
%% TENSOR_GRID_DISPLAY displays a tensor product grid.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    30 December 2011
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, the spatial dimension.
%    Only M = 1, 2, and 3 are handled by this program.
%
%    Input, integer N_1D(M), the order of the 1D rules.
%    If N_1D is a scalar, it will be extended to a vector of length M,
%    with all entries equal.
%
%    Input, string RULE, a code for the rule to be used.
%    'CC', Clenshaw-Curtis,
%    'F1', Fejer Type 1,
%    'F2', Fejer Type 2,
%    'GL', Gauss-Legendre,
%    'GP', Gauss-Patterson, (orders 1, 3, 7, 15, 31, 63, 127, 255 or 511 only)
%    'HR', Hermite,
%    'JC', Jacobi,
%    'LG', Laguerre,
%    'NCC', Newton-Cotes Closed,
%    'NCO', Newton-Cotes Open,
%    'NCOH', Newton-Cotes Open Half.
%
%  Local Parameters:
%
%    Local, integer N, the number of points in the tensor product grid.
%
%    Local, real X(M,N), the points in the tensor product grid.
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'TENSOR_GRID_DISPLAY:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Make a 1D/2D/3D plot of a tensor grid.\n' );
%
%  Make sure we have the arguments.
%
  if ( nargin < 1 )
    m = input ( 'Enter the spatial dimension M, 1, 2 or 3:  ' );
  elseif ( ischar ( m ) )
    m = str2num ( m );
  end

  if ( nargin < 2 )
    n_1d = input ( 'Enter the number of points in the 1D grid, N1D:  ' );
  elseif ( ischar ( n_1d ) )
    n_1d = str2num ( n_1d );
  end

  if ( nargin < 3 )
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Quadrature rule options include:\n' );
    fprintf ( 1, '  ''CC'', Clenshaw-Curtis,\n' );
    fprintf ( 1, '  ''F1'', Fejer Type 1,\n' );
    fprintf ( 1, '  ''F2'', Fejer Type 2,\n' );
    fprintf ( 1, '  ''GL'', Gauss-Legendre,\n' );
    fprintf ( 1, '  ''GP'', Gauss-Patterson, (orders 1, 3, 7, 15, 31, 63, 127, 255 or 511 only)\n' );
    fprintf ( 1, '  ''HR'', Hermite,\n' );
    fprintf ( 1, '  ''JC'', Jacobi,\n' );
    fprintf ( 1, '  ''LG'', Laguerre,\n' );
    fprintf ( 1, '  ''NCC'', Newton-Cotes Closed,\n' );
    fprintf ( 1, '  ''NCO'', Newton-Cotes Open,\n' );
    fprintf ( 1, '  ''NCOH'', Newton-Cotes Open Half.\n' );
    rule = input ( 'Enter the 1D quadrature rule, in quotes:  ' );
  end

  if ( 1 < m && length ( n_1d ) == 1 )
    n_1d = n_1d * ones ( m, 1 );
  end

  [ m, n_1d, rule ] = tensor_grid_define ( m, n_1d, rule );

  xt = tensor_product ( m, n_1d, rule );

  clf
  hold on

  if ( m == 1 )

    plot ( xt(1,:), 0, 'b.', 'MarkerSize', 15 );
    xlabel ( '<---X(1)--->' )

  elseif ( m == 2 )

    x = rule_compute ( n_1d(1), rule );
    y = rule_compute ( n_1d(2), rule );

    xmin = min ( x );
    xmax = max ( x );
    ymin = min ( y );
    ymax = max ( y );

    axis_xmin = xmin - 0.05 * max ( ( xmax - xmin ), 1.0 );
    axis_xmax = xmax + 0.05 * max ( ( xmax - xmin ), 1.0 );
    axis_ymin = ymin - 0.05 * max ( ( ymax - ymin ), 1.0 );
    axis_ymax = ymax + 0.05 * max ( ( ymax - ymin ), 1.0 );

    for j = 1 : n_1d(2)
      line ( [ x(1), x(end)], [ y(j), y(j) ], 'Color', 'g', 'LineWidth', 2 )
    end

    for i = 1 : n_1d(1)
      line ( [ x(i), x(i)], [ y(1), y(end) ], 'Color', 'g', 'LineWidth', 2 )
    end

    scatter ( xt(1,:), xt(2,:), 150, 'b', '.' );

    xlabel ( '<---X(1)--->' )
    ylabel ( '<---X(2)--->' )

    axis ( [ axis_xmin, axis_xmax, axis_ymin, axis_ymax ] )
    axis equal

  elseif ( m == 3 )

    x = rule_compute ( n_1d(1), rule );
    y = rule_compute ( n_1d(2), rule );
    z = rule_compute ( n_1d(3), rule );

    for j = 1 : n_1d(2)
      for k = 1 : n_1d(3)
        line ( [ x(1), x(end)], [ y(j), y(j) ], [ z(k), z(k) ], 'Color', 'g', 'LineWidth', 2 )
      end
    end

    for i = 1 : n_1d(1)
      for k = 1 : n_1d(3)
        line ( [ x(i), x(i)], [ y(1), y(end) ], [ z(k), z(k) ], 'Color', 'g', 'LineWidth', 2 )
      end
    end

    for i = 1 : n_1d(1)
      for j = 1 : n_1d(2)
        line ( [ x(i), x(i)], [ y(j), y(j) ], [ z(1), z(end) ], 'Color', 'g', 'LineWidth', 2 )
      end
    end

    scatter3 ( xt(1,:), xt(2,:), xt(3,:), 1000, 'b', '.' );

    xlabel ( '<---X(1)--->' )
    ylabel ( '<---X(2)--->' )
    zlabel ( '<---X(3)--->' )

    axis equal

  end

  if ( strcmp ( rule, 'cc' ) )
    title ( 'Clenshaw-Curtis grid' )
  elseif ( strcmp ( rule, 'f1' ) )
    title ( 'Fejer Type 1 grid' )
  elseif ( strcmp ( rule, 'f2' ) )
    title ( 'Fejer Type 2 grid' )
  elseif ( strcmp ( rule, 'gl' ) )
    title ( 'Gauss-Legendre grid' )
  elseif ( strcmp ( rule, 'gp' ) )
    title ( 'Gauss-Patterson grid' )
  elseif ( strcmp ( rule, 'hr' ) )
    title ( 'Hermite grid' )
  elseif ( strcmp ( rule, 'jc' ) )
    title ( 'Jacobi grid' )
  elseif ( strcmp ( rule, 'lg' ) )
    title ( 'Laguerre grid' )
  elseif ( strcmp ( rule, 'ncc' ) )
    title ( 'Newton-Cotes Closed grid' )
  elseif ( strcmp ( rule, 'nco' ) )
    title ( 'Newton-Cotes Open grid' )
  elseif ( strcmp ( rule, 'ncoh' ) )
    title ( 'Newton-Cotes Open Half grid' )
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, 'TENSOR_GRID_DISPLAY - Fatal error!\n' );
    fprintf ( 1, '  Unrecognized rule = "%s".\n', rule );
    error ( 'TENSOR_GRID_DISPLAY - Fatal error!' )
  end

  hold off

  pause ( 5 )

  filename = sprintf ( '%s_%dd.png', rule, m );
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'TENSOR_GRID_DISPLAY:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  return
end
function [ x, w ] = cc_compute ( n )

%*****************************************************************************80
%
%% CC_COMPUTE computes a Clenshaw Curtis quadrature rule.
%
%  Discussion:
%
%    Our convention is that the abscissas are numbered from left to right.
%
%    The rule is defined on [-1,1].
%
%    The integral to approximate:
%
%      Integral ( -1 <= X <= 1 ) F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    15 February 2009
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the order of the rule.
%    1 <= N.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  if ( n < 1 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'CC_COMPUTE - Fatal error!\n' );
    fprintf ( 1, '  Illegal value of N = %d\n', n );
    error ( 'CC_COMPUTE - Fatal error!' );
  end

  w = zeros ( n, 1 );
  x = zeros ( n, 1 );

  if ( n == 1 )
    x(1) = 0.0;
    w(1) = 2.0;
    return
  end

  for i = 1 : n
    x(i) = cos ( ( n - i ) * pi / ( n - 1 ) );
  end

  x(1) = -1.0;
  if ( mod ( n, 2 ) == 1 )
    x((n+1)/2) = 0.0;
  end
  x(n) = +1.0;

  for i = 1 : n

    theta = ( i - 1 ) * pi / ( n - 1 );

    w(i) = 1.0;

    for j = 1 : ( n - 1 ) / 2

      if ( 2 * j == ( n - 1 ) )
        b = 1.0;
      else
        b = 2.0;
      end

      w(i) = w(i) - b * cos ( 2.0 * j * theta ) / ( 4 * j * j - 1 );

    end

  end

  w(1)     =       w(1)     / ( n - 1 );
  w(2:n-1) = 2.0 * w(2:n-1) / ( n - 1 );
  w(n)     =       w(n)     / ( n - 1 );

  return
end
function [ x, w ] = f1_compute ( n )

%*****************************************************************************80
%
%% F1_COMPUTE computes a Fejer type 1 quadrature rule.
%
%  Discussion:
%
%    This method uses a direct approach.  The paper by Waldvogel
%    exhibits a more efficient approach using Fourier transforms.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    03 March 2007
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Philip Davis, Philip Rabinowitz,
%    Methods of Numerical Integration,
%    Second Edition,
%    Dover, 2007,
%    ISBN: 0486453391,
%    LC: QA299.3.D28.
%
%    Walter Gautschi,
%    Numerical Quadrature in the Presence of a Singularity,
%    SIAM Journal on Numerical Analysis,
%    Volume 4, Number 3, 1967, pages 357-362.
%
%    Joerg Waldvogel,
%    Fast Construction of the Fejer and Clenshaw-Curtis Quadrature Rules,
%    BIT Numerical Mathematics,
%    Volume 43, Number 1, 2003, pages 1-18.
%
%  Parameters:
%
%    Input, integer N, the order.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  x = zeros ( n, 1 );
  w = zeros ( n, 1 );

  theta(1:n) = ( 2*n-1 : -2 : 1 ) * pi / ( 2 * n );
  x(1:n) = cos ( theta(1:n) );

  for i = 1 : n
    w(i) = 1;
    for j = 1 : floor ( n / 2 )
      w(i) = w(i) - 2 * cos ( 2 * j * theta(i) ) / ( 4 * j * j - 1 );
    end
  end

  w(1:n) = 2 * w(1:n) / n;

  return
end
function [ x, w ] = f2_compute ( n )

%*****************************************************************************80
%
%% F2_COMPUTE computes a Fejer type 2 quadrature rule.
%
%  Discussion:
%
%    This method uses a direct approach.  The paper by Waldvogel
%    exhibits a more efficient approach using Fourier transforms.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    03 March 2007
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Philip Davis, Philip Rabinowitz,
%    Methods of Numerical Integration,
%    Second Edition,
%    Dover, 2007,
%    ISBN: 0486453391,
%    LC: QA299.3.D28.
%
%    Walter Gautschi,
%    Numerical Quadrature in the Presence of a Singularity,
%    SIAM Journal on Numerical Analysis,
%    Volume 4, Number 3, 1967, pages 357-362.
%
%    Joerg Waldvogel,
%    Fast Construction of the Fejer and Clenshaw-Curtis Quadrature Rules,
%    BIT Numerical Mathematics,
%    Volume 43, Number 1, 2003, pages 1-18.
%
%  Parameters:
%
%    Input, integer N, the order.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  x = zeros ( n, 1 );
  w = zeros ( n, 1 );

  theta(1:n) = ( n : -1 : 1 ) * pi / ( n + 1 );
  x(1:n) = cos ( theta(1:n) );

  for i = 1 : n

    w(i) = 1;

    for j = 1 : floor ( ( n - 1 ) / 2 )
      w(i) = w(i) - 2 * cos ( 2 * j * theta(i) ) / ( 4 * j * j - 1 );
    end

    if ( 2 < n )
      p = 2 * floor ( ( n + 1 ) / 2 ) - 1;
      w(i) = w(i) - cos ( ( p + 1 ) * theta(i) ) / p;
    end

  end

  w(1:n) = 2 * w(1:n) / ( n + 1 );

  return
end
function [ x, w ] = gl_compute ( n )

%*****************************************************************************80
%
%% GL_COMPUTE: Gauss-Legendre quadrature by Davis-Rabinowitz method.
%
%  Discussion:
%
%    The integral:
%
%      Integral ( -1 <= X <= 1 ) F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    10 February 2010
%
%  Author:
%
%    Original FORTRAN77 version by Philip Davis, Philip Rabinowitz.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Philip Davis, Philip Rabinowitz,
%    Methods of Numerical Integration,
%    Second Edition,
%    Dover, 2007,
%    ISBN: 0486453391,
%    LC: QA299.3.D28.
%
%  Parameters:
%
%    Input, integer N, the order.
%    N must be greater than 0.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  x = zeros ( n, 1 );
  w = zeros ( n, 1 );

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

  e1 = n * ( n + 1 );

  m = floor ( ( n + 1 ) / 2 );

  for i = 1 : floor ( ( n + 1 ) / 2 )

    mp1mi = m + 1 - i;

    t = ( 4 * i - 1 ) * pi / ( 4 * n + 2 );

    x0 = cos(t) * ( 1.0 - ( 1.0 - 1.0 / ( n ) ) / ( 8 * n * n ) );

    pkm1 = 1.0;
    pk = x0;

    for k = 2 : n
      pkp1 = 2.0 * x0 * pk - pkm1 - ( x0 * pk - pkm1 ) / k;
      pkm1 = pk;
      pk = pkp1;
    end

    d1 = n * ( pkm1 - x0 * pk );

    dpn = d1 / ( 1.0 - x0 * x0 );

    d2pn = ( 2.0 * x0 * dpn - e1 * pk ) / ( 1.0 - x0 * x0 );

    d3pn = ( 4.0 * x0 * d2pn + ( 2.0 - e1 ) * dpn ) / ( 1.0 - x0 * x0 );

    d4pn = ( 6.0 * x0 * d3pn + ( 6.0 - e1 ) * d2pn ) / ( 1.0 - x0 * x0 );

    u = pk / dpn;
    v = d2pn / dpn;
%
%  Initial approximation H:
%
    h = - u * ( 1.0 + 0.5 * u * ( v + u * ( v * v - d3pn / ( 3.0 * dpn ) ) ) );
%
%  Refine H using one step of Newton's method:
%
    p = pk + h * ( dpn + 0.5 * h * ( d2pn + h / 3.0 ...
      * ( d3pn + 0.25 * h * d4pn ) ) );

    dp = dpn + h * ( d2pn + 0.5 * h * ( d3pn + h * d4pn / 3.0 ) );

    h = h - p / dp;

    xtemp = x0 + h;

    x(mp1mi) = xtemp;

    fx = d1 - h * e1 * ( pk + 0.5 * h * ( dpn + h / 3.0 ...
      * ( d2pn + 0.25 * h * ( d3pn + 0.2 * h * d4pn ) ) ) );

    w(mp1mi) = 2.0 * ( 1.0 - xtemp * xtemp ) / fx / fx;

  end

  if ( mod ( n, 2 ) == 1 )
    x(1) = 0.0;
  end
%
%  Shift the data up.
%
  nmove = floor ( ( n + 1 ) / 2 );
  ncopy = n - nmove;

  for i = 1 : nmove
    iback = n + 1 - i;
    x(iback) = x(iback-ncopy);
    w(iback) = w(iback-ncopy);
  end
%
%  Reflect values for the negative abscissas.
%
  for i = 1 : n - nmove
    x(i) = - x(n+1-i);
    w(i) = w(n+1-i);
  end

  return
end
function [ x, w ] = gp_set ( n )

%*****************************************************************************80
%
%% GP_SET sets abscissas and weights for Gauss-Patterson quadrature.
%
%  Discussion:
%
%    The integral:
%
%      Integral ( -1 <= X <= 1 ) F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
%
%    The zeroth rule, of order 1, is the standard Gauss-Legendre rule.
%
%    The first rule, of order 3, is the standard Gauss-Legendre rule.
%
%    The second rule, of order 7, includes the abscissas of the previous
%    rule.
%
%    Each subsequent rule is nested in a similar way.  Rules are available
%    of orders 1, 3, 7, 15, 31, 63, 127, 255 or 511.
%
%    The data for N = 511 was supplied by Dirk Laurie.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 September 2011
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Prem Kythe, Michael Schaeferkotter,
%    Handbook of Computational Methods for Integration,
%    Chapman and Hall, 2004,
%    ISBN: 1-58488-428-2,
%    LC: QA299.3.K98.
%
%    Thomas Patterson,
%    The Optimal Addition of Points to Quadrature Formulae,
%    Mathematics of Computation,
%    Volume 22, Number 104, October 1968, pages 847-856.
%
%  Parameters:
%
%    Input, integer N, the order.
%    N must be 1, 3, 7, 15, 31, 63, 127, 255 or 511.
%
%    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) = 2.0;

  elseif ( n == 3 )

    x(1) = -0.77459666924148337704;
    x(2) =  0.0;
    x(3) =  0.77459666924148337704;

    w(1) = 0.555555555555555555556;
    w(2) = 0.888888888888888888889;
    w(3) = 0.555555555555555555556;

  elseif ( n == 7 )

    x(1) = -0.96049126870802028342;
    x(2) = -0.77459666924148337704;
    x(3) = -0.43424374934680255800;
    x(4) =  0.0;
    x(5) =  0.43424374934680255800;
    x(6) =  0.77459666924148337704;
    x(7) =  0.96049126870802028342;

    w(1) = 0.104656226026467265194;
    w(2) = 0.268488089868333440729;
    w(3) = 0.401397414775962222905;
    w(4) = 0.450916538658474142345;
    w(5) = 0.401397414775962222905;
    w(6) = 0.268488089868333440729;
    w(7) = 0.104656226026467265194;

  elseif ( n == 15 )

    x( 1) = -0.99383196321275502221;
    x( 2) = -0.96049126870802028342;
    x( 3) = -0.88845923287225699889;
    x( 4) = -0.77459666924148337704;
    x( 5) = -0.62110294673722640294;
    x( 6) = -0.43424374934680255800;
    x( 7) = -0.22338668642896688163;
    x( 8) =  0.0;
    x( 9) =  0.22338668642896688163;
    x(10) =  0.43424374934680255800;
    x(11) =  0.62110294673722640294;
    x(12) =  0.77459666924148337704;
    x(13) =  0.88845923287225699889;
    x(14) =  0.96049126870802028342;
    x(15) =  0.99383196321275502221;

    w( 1) = 0.0170017196299402603390;
    w( 2) = 0.0516032829970797396969;
    w( 3) = 0.0929271953151245376859;
    w( 4) = 0.134415255243784220360;
    w( 5) = 0.171511909136391380787;
    w( 6) = 0.200628529376989021034;
    w( 7) = 0.219156858401587496404;
    w( 8) = 0.225510499798206687386;
    w( 9) = 0.219156858401587496404;
    w(10) = 0.200628529376989021034;
    w(11) = 0.171511909136391380787;
    w(12) = 0.134415255243784220360;
    w(13) = 0.0929271953151245376859;
    w(14) = 0.0516032829970797396969;
    w(15) = 0.0170017196299402603390;

  elseif ( n == 31 )

    x( 1) = -0.99909812496766759766;
    x( 2) = -0.99383196321275502221;
    x( 3) = -0.98153114955374010687;
    x( 4) = -0.96049126870802028342;
    x( 5) = -0.92965485742974005667;
    x( 6) = -0.88845923287225699889;
    x( 7) = -0.83672593816886873550;
    x( 8) = -0.77459666924148337704;
    x( 9) = -0.70249620649152707861;
    x(10) = -0.62110294673722640294;
    x(11) = -0.53131974364437562397;
    x(12) = -0.43424374934680255800;
    x(13) = -0.33113539325797683309;
    x(14) = -0.22338668642896688163;
    x(15) = -0.11248894313318662575;
    x(16) =  0.0;
    x(17) =  0.11248894313318662575;
    x(18) =  0.22338668642896688163;
    x(19) =  0.33113539325797683309;
    x(20) =  0.43424374934680255800;
    x(21) =  0.53131974364437562397;
    x(22) =  0.62110294673722640294;
    x(23) =  0.70249620649152707861;
    x(24) =  0.77459666924148337704;
    x(25) =  0.83672593816886873550;
    x(26) =  0.88845923287225699889;
    x(27) =  0.92965485742974005667;
    x(28) =  0.96049126870802028342;
    x(29) =  0.98153114955374010687;
    x(30) =  0.99383196321275502221;
    x(31) =  0.99909812496766759766;

    w( 1) = 0.00254478079156187441540;
    w( 2) = 0.00843456573932110624631;
    w( 3) = 0.0164460498543878109338;
    w( 4) = 0.0258075980961766535646;
    w( 5) = 0.0359571033071293220968;
    w( 6) = 0.0464628932617579865414;
    w( 7) = 0.0569795094941233574122;
    w( 8) = 0.0672077542959907035404;
    w( 9) = 0.0768796204990035310427;
    w(10) = 0.0857559200499903511542;
    w(11) = 0.0936271099812644736167;
    w(12) = 0.100314278611795578771;
    w(13) = 0.105669893580234809744;
    w(14) = 0.109578421055924638237;
    w(15) = 0.111956873020953456880;
    w(16) = 0.112755256720768691607;
    w(17) = 0.111956873020953456880;
    w(18) = 0.109578421055924638237;
    w(19) = 0.105669893580234809744;
    w(20) = 0.100314278611795578771;
    w(21) = 0.0936271099812644736167;
    w(22) = 0.0857559200499903511542;
    w(23) = 0.0768796204990035310427;
    w(24) = 0.0672077542959907035404;
    w(25) = 0.0569795094941233574122;
    w(26) = 0.0464628932617579865414;
    w(27) = 0.0359571033071293220968;
    w(28) = 0.0258075980961766535646;
    w(29) = 0.0164460498543878109338;
    w(30) = 0.00843456573932110624631;
    w(31) = 0.00254478079156187441540;

  elseif ( n == 63 )

    x( 1) = -0.99987288812035761194;
    x( 2) = -0.99909812496766759766;
    x( 3) = -0.99720625937222195908;
    x( 4) = -0.99383196321275502221;
    x( 5) = -0.98868475754742947994;
    x( 6) = -0.98153114955374010687;
    x( 7) = -0.97218287474858179658;
    x( 8) = -0.96049126870802028342;
    x( 9) = -0.94634285837340290515;
    x(10) = -0.92965485742974005667;
    x(11) = -0.91037115695700429250;
    x(12) = -0.88845923287225699889;
    x(13) = -0.86390793819369047715;
    x(14) = -0.83672593816886873550;
    x(15) = -0.80694053195021761186;
    x(16) = -0.77459666924148337704;
    x(17) = -0.73975604435269475868;
    x(18) = -0.70249620649152707861;
    x(19) = -0.66290966002478059546;
    x(20) = -0.62110294673722640294;
    x(21) = -0.57719571005204581484;
    x(22) = -0.53131974364437562397;
    x(23) = -0.48361802694584102756;
    x(24) = -0.43424374934680255800;
    x(25) = -0.38335932419873034692;
    x(26) = -0.33113539325797683309;
    x(27) = -0.27774982202182431507;
    x(28) = -0.22338668642896688163;
    x(29) = -0.16823525155220746498;
    x(30) = -0.11248894313318662575;
    x(31) = -0.056344313046592789972;
    x(32) =  0.0;
    x(33) =  0.056344313046592789972;
    x(34) =  0.11248894313318662575;
    x(35) =  0.16823525155220746498;
    x(36) =  0.22338668642896688163;
    x(37) =  0.27774982202182431507;
    x(38) =  0.33113539325797683309;
    x(39) =  0.38335932419873034692;
    x(40) =  0.43424374934680255800;
    x(41) =  0.48361802694584102756;
    x(42) =  0.53131974364437562397;
    x(43) =  0.57719571005204581484;
    x(44) =  0.62110294673722640294;
    x(45) =  0.66290966002478059546;
    x(46) =  0.70249620649152707861;
    x(47) =  0.73975604435269475868;
    x(48) =  0.77459666924148337704;
    x(49) =  0.80694053195021761186;
    x(50) =  0.83672593816886873550;
    x(51) =  0.86390793819369047715;
    x(52) =  0.88845923287225699889;
    x(53) =  0.91037115695700429250;
    x(54) =  0.92965485742974005667;
    x(55) =  0.94634285837340290515;
    x(56) =  0.96049126870802028342;
    x(57) =  0.97218287474858179658;
    x(58) =  0.98153114955374010687;
    x(59) =  0.98868475754742947994;
    x(60) =  0.99383196321275502221;
    x(61) =  0.99720625937222195908;
    x(62) =  0.99909812496766759766;
    x(63) =  0.99987288812035761194;

    w( 1) = 0.000363221481845530659694;
    w( 2) = 0.00126515655623006801137;
    w( 3) = 0.00257904979468568827243;
    w( 4) = 0.00421763044155885483908;
    w( 5) = 0.00611550682211724633968;
    w( 6) = 0.00822300795723592966926;
    w( 7) = 0.0104982469096213218983;
    w( 8) = 0.0129038001003512656260;
    w( 9) = 0.0154067504665594978021;
    w(10) = 0.0179785515681282703329;
    w(11) = 0.0205942339159127111492;
    w(12) = 0.0232314466399102694433;
    w(13) = 0.0258696793272147469108;
    w(14) = 0.0284897547458335486125;
    w(15) = 0.0310735511116879648799;
    w(16) = 0.0336038771482077305417;
    w(17) = 0.0360644327807825726401;
    w(18) = 0.0384398102494555320386;
    w(19) = 0.0407155101169443189339;
    w(20) = 0.0428779600250077344929;
    w(21) = 0.0449145316536321974143;
    w(22) = 0.0468135549906280124026;
    w(23) = 0.0485643304066731987159;
    w(24) = 0.0501571393058995374137;
    w(25) = 0.0515832539520484587768;
    w(26) = 0.0528349467901165198621;
    w(27) = 0.0539054993352660639269;
    w(28) = 0.0547892105279628650322;
    w(29) = 0.0554814043565593639878;
    w(30) = 0.0559784365104763194076;
    w(31) = 0.0562776998312543012726;
    w(32) = 0.0563776283603847173877;
    w(33) = 0.0562776998312543012726;
    w(34) = 0.0559784365104763194076;
    w(35) = 0.0554814043565593639878;
    w(36) = 0.0547892105279628650322;
    w(37) = 0.0539054993352660639269;
    w(38) = 0.0528349467901165198621;
    w(39) = 0.0515832539520484587768;
    w(40) = 0.0501571393058995374137;
    w(41) = 0.0485643304066731987159;
    w(42) = 0.0468135549906280124026;
    w(43) = 0.0449145316536321974143;
    w(44) = 0.0428779600250077344929;
    w(45) = 0.0407155101169443189339;
    w(46) = 0.0384398102494555320386;
    w(47) = 0.0360644327807825726401;
    w(48) = 0.0336038771482077305417;
    w(49) = 0.0310735511116879648799;
    w(50) = 0.0284897547458335486125;
    w(51) = 0.0258696793272147469108;
    w(52) = 0.0232314466399102694433;
    w(53) = 0.0205942339159127111492;
    w(54) = 0.0179785515681282703329;
    w(55) = 0.0154067504665594978021;
    w(56) = 0.0129038001003512656260;
    w(57) = 0.0104982469096213218983;
    w(58) = 0.00822300795723592966926;
    w(59) = 0.00611550682211724633968;
    w(60) = 0.00421763044155885483908;
    w(61) = 0.00257904979468568827243;
    w(62) = 0.00126515655623006801137;
    w(63) = 0.000363221481845530659694;

  elseif ( n == 127 )

    x(  1) = -0.99998243035489159858;
    x(  2) = -0.99987288812035761194;
    x(  3) = -0.99959879967191068325;
    x(  4) = -0.99909812496766759766;
    x(  5) = -0.99831663531840739253;
    x(  6) = -0.99720625937222195908;
    x(  7) = -0.99572410469840718851;
    x(  8) = -0.99383196321275502221;
    x(  9) = -0.99149572117810613240;
    x( 10) = -0.98868475754742947994;
    x( 11) = -0.98537149959852037111;
    x( 12) = -0.98153114955374010687;
    x( 13) = -0.97714151463970571416;
    x( 14) = -0.97218287474858179658;
    x( 15) = -0.96663785155841656709;
    x( 16) = -0.96049126870802028342;
    x( 17) = -0.95373000642576113641;
    x( 18) = -0.94634285837340290515;
    x( 19) = -0.93832039777959288365;
    x( 20) = -0.92965485742974005667;
    x( 21) = -0.92034002547001242073;
    x( 22) = -0.91037115695700429250;
    x( 23) = -0.89974489977694003664;
    x( 24) = -0.88845923287225699889;
    x( 25) = -0.87651341448470526974;
    x( 26) = -0.86390793819369047715;
    x( 27) = -0.85064449476835027976;
    x( 28) = -0.83672593816886873550;
    x( 29) = -0.82215625436498040737;
    x( 30) = -0.80694053195021761186;
    x( 31) = -0.79108493379984836143;
    x( 32) = -0.77459666924148337704;
    x( 33) = -0.75748396638051363793;
    x( 34) = -0.73975604435269475868;
    x( 35) = -0.72142308537009891548;
    x( 36) = -0.70249620649152707861;
    x( 37) = -0.68298743109107922809;
    x( 38) = -0.66290966002478059546;
    x( 39) = -0.64227664250975951377;
    x( 40) = -0.62110294673722640294;
    x( 41) = -0.59940393024224289297;
    x( 42) = -0.57719571005204581484;
    x( 43) = -0.55449513263193254887;
    x( 44) = -0.53131974364437562397;
    x( 45) = -0.50768775753371660215;
    x( 46) = -0.48361802694584102756;
    x( 47) = -0.45913001198983233287;
    x( 48) = -0.43424374934680255800;
    x( 49) = -0.40897982122988867241;
    x( 50) = -0.38335932419873034692;
    x( 51) = -0.35740383783153215238;
    x( 52) = -0.33113539325797683309;
    x( 53) = -0.30457644155671404334;
    x( 54) = -0.27774982202182431507;
    x( 55) = -0.25067873030348317661;
    x( 56) = -0.22338668642896688163;
    x( 57) = -0.19589750271110015392;
    x( 58) = -0.16823525155220746498;
    x( 59) = -0.14042423315256017459;
    x( 60) = -0.11248894313318662575;
    x( 61) = -0.084454040083710883710;
    x( 62) = -0.056344313046592789972;
    x( 63) = -0.028184648949745694339;
    x( 64) =  0.0;
    x( 65) =  0.028184648949745694339;
    x( 66) =  0.056344313046592789972;
    x( 67) =  0.084454040083710883710;
    x( 68) =  0.11248894313318662575;
    x( 69) =  0.14042423315256017459;
    x( 70) =  0.16823525155220746498;
    x( 71) =  0.19589750271110015392;
    x( 72) =  0.22338668642896688163;
    x( 73) =  0.25067873030348317661;
    x( 74) =  0.27774982202182431507;
    x( 75) =  0.30457644155671404334;
    x( 76) =  0.33113539325797683309;
    x( 77) =  0.35740383783153215238;
    x( 78) =  0.38335932419873034692;
    x( 79) =  0.40897982122988867241;
    x( 80) =  0.43424374934680255800;
    x( 81) =  0.45913001198983233287;
    x( 82) =  0.48361802694584102756;
    x( 83) =  0.50768775753371660215;
    x( 84) =  0.53131974364437562397;
    x( 85) =  0.55449513263193254887;
    x( 86) =  0.57719571005204581484;
    x( 87) =  0.59940393024224289297;
    x( 88) =  0.62110294673722640294;
    x( 89) =  0.64227664250975951377;
    x( 90) =  0.66290966002478059546;
    x( 91) =  0.68298743109107922809;
    x( 92) =  0.70249620649152707861;
    x( 93) =  0.72142308537009891548;
    x( 94) =  0.73975604435269475868;
    x( 95) =  0.75748396638051363793;
    x( 96) =  0.77459666924148337704;
    x( 97) =  0.79108493379984836143;
    x( 98) =  0.80694053195021761186;
    x( 99) =  0.82215625436498040737;
    x(100) =  0.83672593816886873550;
    x(101) =  0.85064449476835027976;
    x(102) =  0.86390793819369047715;
    x(103) =  0.87651341448470526974;
    x(104) =  0.88845923287225699889;
    x(105) =  0.89974489977694003664;
    x(106) =  0.91037115695700429250;
    x(107) =  0.92034002547001242073;
    x(108) =  0.92965485742974005667;
    x(109) =  0.93832039777959288365;
    x(110) =  0.94634285837340290515;
    x(111) =  0.95373000642576113641;
    x(112) =  0.96049126870802028342;
    x(113) =  0.96663785155841656709;
    x(114) =  0.97218287474858179658;
    x(115) =  0.97714151463970571416;
    x(116) =  0.98153114955374010687;
    x(117) =  0.98537149959852037111;
    x(118) =  0.98868475754742947994;
    x(119) =  0.99149572117810613240;
    x(120) =  0.99383196321275502221;
    x(121) =  0.99572410469840718851;
    x(122) =  0.99720625937222195908;
    x(123) =  0.99831663531840739253;
    x(124) =  0.99909812496766759766;
    x(125) =  0.99959879967191068325;
    x(126) =  0.99987288812035761194;
    x(127) =  0.99998243035489159858;

    w(  1) = 0.0000505360952078625176247;
    w(  2) = 0.000180739564445388357820;
    w(  3) = 0.000377746646326984660274;
    w(  4) = 0.000632607319362633544219;
    w(  5) = 0.000938369848542381500794;
    w(  6) = 0.00128952408261041739210;
    w(  7) = 0.00168114286542146990631;
    w(  8) = 0.00210881524572663287933;
    w(  9) = 0.00256876494379402037313;
    w( 10) = 0.00305775341017553113613;
    w( 11) = 0.00357289278351729964938;
    w( 12) = 0.00411150397865469304717;
    w( 13) = 0.00467105037211432174741;
    w( 14) = 0.00524912345480885912513;
    w( 15) = 0.00584344987583563950756;
    w( 16) = 0.00645190005017573692280;
    w( 17) = 0.00707248999543355546805;
    w( 18) = 0.00770337523327974184817;
    w( 19) = 0.00834283875396815770558;
    w( 20) = 0.00898927578406413572328;
    w( 21) = 0.00964117772970253669530;
    w( 22) = 0.0102971169579563555237;
    w( 23) = 0.0109557333878379016480;
    w( 24) = 0.0116157233199551347270;
    w( 25) = 0.0122758305600827700870;
    w( 26) = 0.0129348396636073734547;
    w( 27) = 0.0135915710097655467896;
    w( 28) = 0.0142448773729167743063;
    w( 29) = 0.0148936416648151820348;
    w( 30) = 0.0155367755558439824399;
    w( 31) = 0.0161732187295777199419;
    w( 32) = 0.0168019385741038652709;
    w( 33) = 0.0174219301594641737472;
    w( 34) = 0.0180322163903912863201;
    w( 35) = 0.0186318482561387901863;
    w( 36) = 0.0192199051247277660193;
    w( 37) = 0.0197954950480974994880;
    w( 38) = 0.0203577550584721594669;
    w( 39) = 0.0209058514458120238522;
    w( 40) = 0.0214389800125038672465;
    w( 41) = 0.0219563663053178249393;
    w( 42) = 0.0224572658268160987071;
    w( 43) = 0.0229409642293877487608;
    w( 44) = 0.0234067774953140062013;
    w( 45) = 0.0238540521060385400804;
    w( 46) = 0.0242821652033365993580;
    w( 47) = 0.0246905247444876769091;
    w( 48) = 0.0250785696529497687068;
    w( 49) = 0.0254457699654647658126;
    w( 50) = 0.0257916269760242293884;
    w( 51) = 0.0261156733767060976805;
    w( 52) = 0.0264174733950582599310;
    w( 53) = 0.0266966229274503599062;
    w( 54) = 0.0269527496676330319634;
    w( 55) = 0.0271855132296247918192;
    w( 56) = 0.0273946052639814325161;
    w( 57) = 0.0275797495664818730349;
    w( 58) = 0.0277407021782796819939;
    w( 59) = 0.0278772514766137016085;
    w( 60) = 0.0279892182552381597038;
    w( 61) = 0.0280764557938172466068;
    w( 62) = 0.0281388499156271506363;
    w( 63) = 0.0281763190330166021307;
    w( 64) = 0.0281888141801923586938;
    w( 65) = 0.0281763190330166021307;
    w( 66) = 0.0281388499156271506363;
    w( 67) = 0.0280764557938172466068;
    w( 68) = 0.0279892182552381597038;
    w( 69) = 0.0278772514766137016085;
    w( 70) = 0.0277407021782796819939;
    w( 71) = 0.0275797495664818730349;
    w( 72) = 0.0273946052639814325161;
    w( 73) = 0.0271855132296247918192;
    w( 74) = 0.0269527496676330319634;
    w( 75) = 0.0266966229274503599062;
    w( 76) = 0.0264174733950582599310;
    w( 77) = 0.0261156733767060976805;
    w( 78) = 0.0257916269760242293884;
    w( 79) = 0.0254457699654647658126;
    w( 80) = 0.0250785696529497687068;
    w( 81) = 0.0246905247444876769091;
    w( 82) = 0.0242821652033365993580;
    w( 83) = 0.0238540521060385400804;
    w( 84) = 0.0234067774953140062013;
    w( 85) = 0.0229409642293877487608;
    w( 86) = 0.0224572658268160987071;
    w( 87) = 0.0219563663053178249393;
    w( 88) = 0.0214389800125038672465;
    w( 89) = 0.0209058514458120238522;
    w( 90) = 0.0203577550584721594669;
    w( 91) = 0.0197954950480974994880;
    w( 92) = 0.0192199051247277660193;
    w( 93) = 0.0186318482561387901863;
    w( 94) = 0.0180322163903912863201;
    w( 95) = 0.0174219301594641737472;
    w( 96) = 0.0168019385741038652709;
    w( 97) = 0.0161732187295777199419;
    w( 98) = 0.0155367755558439824399;
    w( 99) = 0.0148936416648151820348;
    w(100) = 0.0142448773729167743063;
    w(101) = 0.0135915710097655467896;
    w(102) = 0.0129348396636073734547;
    w(103) = 0.0122758305600827700870;
    w(104) = 0.0116157233199551347270;
    w(105) = 0.0109557333878379016480;
    w(106) = 0.0102971169579563555237;
    w(107) = 0.00964117772970253669530;
    w(108) = 0.00898927578406413572328;
    w(109) = 0.00834283875396815770558;
    w(110) = 0.00770337523327974184817;
    w(111) = 0.00707248999543355546805;
    w(112) = 0.00645190005017573692280;
    w(113) = 0.00584344987583563950756;
    w(114) = 0.00524912345480885912513;
    w(115) = 0.00467105037211432174741;
    w(116) = 0.00411150397865469304717;
    w(117) = 0.00357289278351729964938;
    w(118) = 0.00305775341017553113613;
    w(119) = 0.00256876494379402037313;
    w(120) = 0.00210881524572663287933;
    w(121) = 0.00168114286542146990631;
    w(122) = 0.00128952408261041739210;
    w(123) = 0.000938369848542381500794;
    w(124) = 0.000632607319362633544219;
    w(125) = 0.000377746646326984660274;
    w(126) = 0.000180739564445388357820;
    w(127) = 0.0000505360952078625176247;

  elseif ( n == 255 )

    x(  1) = -0.99999759637974846462E+00;
    x(  2) = -0.99998243035489159858E+00;
    x(  3) = -0.99994399620705437576E+00;
    x(  4) = -0.99987288812035761194E+00;
    x(  5) = -0.99976049092443204733E+00;
    x(  6) = -0.99959879967191068325E+00;
    x(  7) = -0.99938033802502358193E+00;
    x(  8) = -0.99909812496766759766E+00;
    x(  9) = -0.99874561446809511470E+00;
    x( 10) = -0.99831663531840739253E+00;
    x( 11) = -0.99780535449595727456E+00;
    x( 12) = -0.99720625937222195908E+00;
    x( 13) = -0.99651414591489027385E+00;
    x( 14) = -0.99572410469840718851E+00;
    x( 15) = -0.99483150280062100052E+00;
    x( 16) = -0.99383196321275502221E+00;
    x( 17) = -0.99272134428278861533E+00;
    x( 18) = -0.99149572117810613240E+00;
    x( 19) = -0.99015137040077015918E+00;
    x( 20) = -0.98868475754742947994E+00;
    x( 21) = -0.98709252795403406719E+00;
    x( 22) = -0.98537149959852037111E+00;
    x( 23) = -0.98351865757863272876E+00;
    x( 24) = -0.98153114955374010687E+00;
    x( 25) = -0.97940628167086268381E+00;
    x( 26) = -0.97714151463970571416E+00;
    x( 27) = -0.97473445975240266776E+00;
    x( 28) = -0.97218287474858179658E+00;
    x( 29) = -0.96948465950245923177E+00;
    x( 30) = -0.96663785155841656709E+00;
    x( 31) = -0.96364062156981213252E+00;
    x( 32) = -0.96049126870802028342E+00;
    x( 33) = -0.95718821610986096274E+00;
    x( 34) = -0.95373000642576113641E+00;
    x( 35) = -0.95011529752129487656E+00;
    x( 36) = -0.94634285837340290515E+00;
    x( 37) = -0.94241156519108305981E+00;
    x( 38) = -0.93832039777959288365E+00;
    x( 39) = -0.93406843615772578800E+00;
    x( 40) = -0.92965485742974005667E+00;
    x( 41) = -0.92507893290707565236E+00;
    x( 42) = -0.92034002547001242073E+00;
    x( 43) = -0.91543758715576504064E+00;
    x( 44) = -0.91037115695700429250E+00;
    x( 45) = -0.90514035881326159519E+00;
    x( 46) = -0.89974489977694003664E+00;
    x( 47) = -0.89418456833555902286E+00;
    x( 48) = -0.88845923287225699889E+00;
    x( 49) = -0.88256884024734190684E+00;
    x( 50) = -0.87651341448470526974E+00;
    x( 51) = -0.87029305554811390585E+00;
    x( 52) = -0.86390793819369047715E+00;
    x( 53) = -0.85735831088623215653E+00;
    x( 54) = -0.85064449476835027976E+00;
    x( 55) = -0.84376688267270860104E+00;
    x( 56) = -0.83672593816886873550E+00;
    x( 57) = -0.82952219463740140018E+00;
    x( 58) = -0.82215625436498040737E+00;
    x( 59) = -0.81462878765513741344E+00;
    x( 60) = -0.80694053195021761186E+00;
    x( 61) = -0.79909229096084140180E+00;
    x( 62) = -0.79108493379984836143E+00;
    x( 63) = -0.78291939411828301639E+00;
    x( 64) = -0.77459666924148337704E+00;
    x( 65) = -0.76611781930376009072E+00;
    x( 66) = -0.75748396638051363793E+00;
    x( 67) = -0.74869629361693660282E+00;
    x( 68) = -0.73975604435269475868E+00;
    x( 69) = -0.73066452124218126133E+00;
    x( 70) = -0.72142308537009891548E+00;
    x( 71) = -0.71203315536225203459E+00;
    x( 72) = -0.70249620649152707861E+00;
    x( 73) = -0.69281376977911470289E+00;
    x( 74) = -0.68298743109107922809E+00;
    x( 75) = -0.67301883023041847920E+00;
    x( 76) = -0.66290966002478059546E+00;
    x( 77) = -0.65266166541001749610E+00;
    x( 78) = -0.64227664250975951377E+00;
    x( 79) = -0.63175643771119423041E+00;
    x( 80) = -0.62110294673722640294E+00;
    x( 81) = -0.61031811371518640016E+00;
    x( 82) = -0.59940393024224289297E+00;
    x( 83) = -0.58836243444766254143E+00;
    x( 84) = -0.57719571005204581484E+00;
    x( 85) = -0.56590588542365442262E+00;
    x( 86) = -0.55449513263193254887E+00;
    x( 87) = -0.54296566649831149049E+00;
    x( 88) = -0.53131974364437562397E+00;
    x( 89) = -0.51955966153745702199E+00;
    x( 90) = -0.50768775753371660215E+00;
    x( 91) = -0.49570640791876146017E+00;
    x( 92) = -0.48361802694584102756E+00;
    x( 93) = -0.47142506587165887693E+00;
    x( 94) = -0.45913001198983233287E+00;
    x( 95) = -0.44673538766202847374E+00;
    x( 96) = -0.43424374934680255800E+00;
    x( 97) = -0.42165768662616330006E+00;
    x( 98) = -0.40897982122988867241E+00;
    x( 99) = -0.39621280605761593918E+00;
    x(100) = -0.38335932419873034692E+00;
    x(101) = -0.37042208795007823014E+00;
    x(102) = -0.35740383783153215238E+00;
    x(103) = -0.34430734159943802278E+00;
    x(104) = -0.33113539325797683309E+00;
    x(105) = -0.31789081206847668318E+00;
    x(106) = -0.30457644155671404334E+00;
    x(107) = -0.29119514851824668196E+00;
    x(108) = -0.27774982202182431507E+00;
    x(109) = -0.26424337241092676194E+00;
    x(110) = -0.25067873030348317661E+00;
    x(111) = -0.23705884558982972721E+00;
    x(112) = -0.22338668642896688163E+00;
    x(113) = -0.20966523824318119477E+00;
    x(114) = -0.19589750271110015392E+00;
    x(115) = -0.18208649675925219825E+00;
    x(116) = -0.16823525155220746498E+00;
    x(117) = -0.15434681148137810869E+00;
    x(118) = -0.14042423315256017459E+00;
    x(119) = -0.12647058437230196685E+00;
    x(120) = -0.11248894313318662575E+00;
    x(121) = -0.098482396598119202090E+00;
    x(122) = -0.084454040083710883710E+00;
    x(123) = -0.070406976042855179063E+00;
    x(124) = -0.056344313046592789972E+00;
    x(125) = -0.042269164765363603212E+00;
    x(126) = -0.028184648949745694339E+00;
    x(127) = -0.014093886410782462614E+00;
    x(128) =  0.0E+00;
    x(129) =  0.014093886410782462614E+00;
    x(130) =  0.028184648949745694339E+00;
    x(131) =  0.042269164765363603212E+00;
    x(132) =  0.056344313046592789972E+00;
    x(133) =  0.070406976042855179063E+00;
    x(134) =  0.084454040083710883710E+00;
    x(135) =  0.098482396598119202090E+00;
    x(136) =  0.11248894313318662575E+00;
    x(137) =  0.12647058437230196685E+00;
    x(138) =  0.14042423315256017459E+00;
    x(139) =  0.15434681148137810869E+00;
    x(140) =  0.16823525155220746498E+00;
    x(141) =  0.18208649675925219825E+00;
    x(142) =  0.19589750271110015392E+00;
    x(143) =  0.20966523824318119477E+00;
    x(144) =  0.22338668642896688163E+00;
    x(145) =  0.23705884558982972721E+00;
    x(146) =  0.25067873030348317661E+00;
    x(147) =  0.26424337241092676194E+00;
    x(148) =  0.27774982202182431507E+00;
    x(149) =  0.29119514851824668196E+00;
    x(150) =  0.30457644155671404334E+00;
    x(151) =  0.31789081206847668318E+00;
    x(152) =  0.33113539325797683309E+00;
    x(153) =  0.34430734159943802278E+00;
    x(154) =  0.35740383783153215238E+00;
    x(155) =  0.37042208795007823014E+00;
    x(156) =  0.38335932419873034692E+00;
    x(157) =  0.39621280605761593918E+00;
    x(158) =  0.40897982122988867241E+00;
    x(159) =  0.42165768662616330006E+00;
    x(160) =  0.43424374934680255800E+00;
    x(161) =  0.44673538766202847374E+00;
    x(162) =  0.45913001198983233287E+00;
    x(163) =  0.47142506587165887693E+00;
    x(164) =  0.48361802694584102756E+00;
    x(165) =  0.49570640791876146017E+00;
    x(166) =  0.50768775753371660215E+00;
    x(167) =  0.51955966153745702199E+00;
    x(168) =  0.53131974364437562397E+00;
    x(169) =  0.54296566649831149049E+00;
    x(170) =  0.55449513263193254887E+00;
    x(171) =  0.56590588542365442262E+00;
    x(172) =  0.57719571005204581484E+00;
    x(173) =  0.58836243444766254143E+00;
    x(174) =  0.59940393024224289297E+00;
    x(175) =  0.61031811371518640016E+00;
    x(176) =  0.62110294673722640294E+00;
    x(177) =  0.63175643771119423041E+00;
    x(178) =  0.64227664250975951377E+00;
    x(179) =  0.65266166541001749610E+00;
    x(180) =  0.66290966002478059546E+00;
    x(181) =  0.67301883023041847920E+00;
    x(182) =  0.68298743109107922809E+00;
    x(183) =  0.69281376977911470289E+00;
    x(184) =  0.70249620649152707861E+00;
    x(185) =  0.71203315536225203459E+00;
    x(186) =  0.72142308537009891548E+00;
    x(187) =  0.73066452124218126133E+00;
    x(188) =  0.73975604435269475868E+00;
    x(189) =  0.74869629361693660282E+00;
    x(190) =  0.75748396638051363793E+00;
    x(191) =  0.76611781930376009072E+00;
    x(192) =  0.77459666924148337704E+00;
    x(193) =  0.78291939411828301639E+00;
    x(194) =  0.79108493379984836143E+00;
    x(195) =  0.79909229096084140180E+00;
    x(196) =  0.80694053195021761186E+00;
    x(197) =  0.81462878765513741344E+00;
    x(198) =  0.82215625436498040737E+00;
    x(199) =  0.82952219463740140018E+00;
    x(200) =  0.83672593816886873550E+00;
    x(201) =  0.84376688267270860104E+00;
    x(202) =  0.85064449476835027976E+00;
    x(203) =  0.85735831088623215653E+00;
    x(204) =  0.86390793819369047715E+00;
    x(205) =  0.87029305554811390585E+00;
    x(206) =  0.87651341448470526974E+00;
    x(207) =  0.88256884024734190684E+00;
    x(208) =  0.88845923287225699889E+00;
    x(209) =  0.89418456833555902286E+00;
    x(210) =  0.89974489977694003664E+00;
    x(211) =  0.90514035881326159519E+00;
    x(212) =  0.91037115695700429250E+00;
    x(213) =  0.91543758715576504064E+00;
    x(214) =  0.92034002547001242073E+00;
    x(215) =  0.92507893290707565236E+00;
    x(216) =  0.92965485742974005667E+00;
    x(217) =  0.93406843615772578800E+00;
    x(218) =  0.93832039777959288365E+00;
    x(219) =  0.94241156519108305981E+00;
    x(220) =  0.94634285837340290515E+00;
    x(221) =  0.95011529752129487656E+00;
    x(222) =  0.95373000642576113641E+00;
    x(223) =  0.95718821610986096274E+00;
    x(224) =  0.96049126870802028342E+00;
    x(225) =  0.96364062156981213252E+00;
    x(226) =  0.96663785155841656709E+00;
    x(227) =  0.96948465950245923177E+00;
    x(228) =  0.97218287474858179658E+00;
    x(229) =  0.97473445975240266776E+00;
    x(230) =  0.97714151463970571416E+00;
    x(231) =  0.97940628167086268381E+00;
    x(232) =  0.98153114955374010687E+00;
    x(233) =  0.98351865757863272876E+00;
    x(234) =  0.98537149959852037111E+00;
    x(235) =  0.98709252795403406719E+00;
    x(236) =  0.98868475754742947994E+00;
    x(237) =  0.99015137040077015918E+00;
    x(238) =  0.99149572117810613240E+00;
    x(239) =  0.99272134428278861533E+00;
    x(240) =  0.99383196321275502221E+00;
    x(241) =  0.99483150280062100052E+00;
    x(242) =  0.99572410469840718851E+00;
    x(243) =  0.99651414591489027385E+00;
    x(244) =  0.99720625937222195908E+00;
    x(245) =  0.99780535449595727456E+00;
    x(246) =  0.99831663531840739253E+00;
    x(247) =  0.99874561446809511470E+00;
    x(248) =  0.99909812496766759766E+00;
    x(249) =  0.99938033802502358193E+00;
    x(250) =  0.99959879967191068325E+00;
    x(251) =  0.99976049092443204733E+00;
    x(252) =  0.99987288812035761194E+00;
    x(253) =  0.99994399620705437576E+00;
    x(254) =  0.99998243035489159858E+00;
    x(255) =  0.99999759637974846462E+00;

    w(  1) = 0.69379364324108267170E-05;
    w(  2) = 0.25157870384280661489E-04;
    w(  3) = 0.53275293669780613125E-04;
    w(  4) = 0.90372734658751149261E-04;
    w(  5) = 0.13575491094922871973E-03;
    w(  6) = 0.18887326450650491366E-03;
    w(  7) = 0.24921240048299729402E-03;
    w(  8) = 0.31630366082226447689E-03;
    w(  9) = 0.38974528447328229322E-03;
    w( 10) = 0.46918492424785040975E-03;
    w( 11) = 0.55429531493037471492E-03;
    w( 12) = 0.64476204130572477933E-03;
    w( 13) = 0.74028280424450333046E-03;
    w( 14) = 0.84057143271072246365E-03;
    w( 15) = 0.94536151685852538246E-03;
    w( 16) = 0.10544076228633167722E-02;
    w( 17) = 0.11674841174299594077E-02;
    w( 18) = 0.12843824718970101768E-02;
    w( 19) = 0.14049079956551446427E-02;
    w( 20) = 0.15288767050877655684E-02;
    w( 21) = 0.16561127281544526052E-02;
    w( 22) = 0.17864463917586498247E-02;
    w( 23) = 0.19197129710138724125E-02;
    w( 24) = 0.20557519893273465236E-02;
    w( 25) = 0.21944069253638388388E-02;
    w( 26) = 0.23355251860571608737E-02;
    w( 27) = 0.24789582266575679307E-02;
    w( 28) = 0.26245617274044295626E-02;
    w( 29) = 0.27721957645934509940E-02;
    w( 30) = 0.29217249379178197538E-02;
    w( 31) = 0.30730184347025783234E-02;
    w( 32) = 0.32259500250878684614E-02;
    w( 33) = 0.33803979910869203823E-02;
    w( 34) = 0.35362449977167777340E-02;
    w( 35) = 0.36933779170256508183E-02;
    w( 36) = 0.38516876166398709241E-02;
    w( 37) = 0.40110687240750233989E-02;
    w( 38) = 0.41714193769840788528E-02;
    w( 39) = 0.43326409680929828545E-02;
    w( 40) = 0.44946378920320678616E-02;
    w( 41) = 0.46573172997568547773E-02;
    w( 42) = 0.48205888648512683476E-02;
    w( 43) = 0.49843645647655386012E-02;
    w( 44) = 0.51485584789781777618E-02;
    w( 45) = 0.53130866051870565663E-02;
    w( 46) = 0.54778666939189508240E-02;
    w( 47) = 0.56428181013844441585E-02;
    w( 48) = 0.58078616599775673635E-02;
    w( 49) = 0.59729195655081658049E-02;
    w( 50) = 0.61379152800413850435E-02;
    w( 51) = 0.63027734490857587172E-02;
    w( 52) = 0.64674198318036867274E-02;
    w( 53) = 0.66317812429018878941E-02;
    w( 54) = 0.67957855048827733948E-02;
    w( 55) = 0.69593614093904229394E-02;
    w( 56) = 0.71224386864583871532E-02;
    w( 57) = 0.72849479805538070639E-02;
    w( 58) = 0.74468208324075910174E-02;
    w( 59) = 0.76079896657190565832E-02;
    w( 60) = 0.77683877779219912200E-02;
    w( 61) = 0.79279493342948491103E-02;
    w( 62) = 0.80866093647888599710E-02;
    w( 63) = 0.82443037630328680306E-02;
    w( 64) = 0.84009692870519326354E-02;
    w( 65) = 0.85565435613076896192E-02;
    w( 66) = 0.87109650797320868736E-02;
    w( 67) = 0.88641732094824942641E-02;
    w( 68) = 0.90161081951956431600E-02;
    w( 69) = 0.91667111635607884067E-02;
    w( 70) = 0.93159241280693950932E-02;
    w( 71) = 0.94636899938300652943E-02;
    w( 72) = 0.96099525623638830097E-02;
    w( 73) = 0.97546565363174114611E-02;
    w( 74) = 0.98977475240487497440E-02;
    w( 75) = 0.10039172044056840798E-01;
    w( 76) = 0.10178877529236079733E-01;
    w( 77) = 0.10316812330947621682E-01;
    w( 78) = 0.10452925722906011926E-01;
    w( 79) = 0.10587167904885197931E-01;
    w( 80) = 0.10719490006251933623E-01;
    w( 81) = 0.10849844089337314099E-01;
    w( 82) = 0.10978183152658912470E-01;
    w( 83) = 0.11104461134006926537E-01;
    w( 84) = 0.11228632913408049354E-01;
    w( 85) = 0.11350654315980596602E-01;
    w( 86) = 0.11470482114693874380E-01;
    w( 87) = 0.11588074033043952568E-01;
    w( 88) = 0.11703388747657003101E-01;
    w( 89) = 0.11816385890830235763E-01;
    w( 90) = 0.11927026053019270040E-01;
    w( 91) = 0.12035270785279562630E-01;
    w( 92) = 0.12141082601668299679E-01;
    w( 93) = 0.12244424981611985899E-01;
    w( 94) = 0.12345262372243838455E-01;
    w( 95) = 0.12443560190714035263E-01;
    w( 96) = 0.12539284826474884353E-01;
    w( 97) = 0.12632403643542078765E-01;
    w( 98) = 0.12722884982732382906E-01;
    w( 99) = 0.12810698163877361967E-01;
    w(100) = 0.12895813488012114694E-01;
    w(101) = 0.12978202239537399286E-01;
    w(102) = 0.13057836688353048840E-01;
    w(103) = 0.13134690091960152836E-01;
    w(104) = 0.13208736697529129966E-01;
    w(105) = 0.13279951743930530650E-01;
    w(106) = 0.13348311463725179953E-01;
    w(107) = 0.13413793085110098513E-01;
    w(108) = 0.13476374833816515982E-01;
    w(109) = 0.13536035934956213614E-01;
    w(110) = 0.13592756614812395910E-01;
    w(111) = 0.13646518102571291428E-01;
    w(112) = 0.13697302631990716258E-01;
    w(113) = 0.13745093443001896632E-01;
    w(114) = 0.13789874783240936517E-01;
    w(115) = 0.13831631909506428676E-01;
    w(116) = 0.13870351089139840997E-01;
    w(117) = 0.13906019601325461264E-01;
    w(118) = 0.13938625738306850804E-01;
    w(119) = 0.13968158806516938516E-01;
    w(120) = 0.13994609127619079852E-01;
    w(121) = 0.14017968039456608810E-01;
    w(122) = 0.14038227896908623303E-01;
    w(123) = 0.14055382072649964277E-01;
    w(124) = 0.14069424957813575318E-01;
    w(125) = 0.14080351962553661325E-01;
    w(126) = 0.14088159516508301065E-01;
    w(127) = 0.14092845069160408355E-01;
    w(128) = 0.14094407090096179347E-01;
    w(129) = 0.14092845069160408355E-01;
    w(130) = 0.14088159516508301065E-01;
    w(131) = 0.14080351962553661325E-01;
    w(132) = 0.14069424957813575318E-01;
    w(133) = 0.14055382072649964277E-01;
    w(134) = 0.14038227896908623303E-01;
    w(135) = 0.14017968039456608810E-01;
    w(136) = 0.13994609127619079852E-01;
    w(137) = 0.13968158806516938516E-01;
    w(138) = 0.13938625738306850804E-01;
    w(139) = 0.13906019601325461264E-01;
    w(140) = 0.13870351089139840997E-01;
    w(141) = 0.13831631909506428676E-01;
    w(142) = 0.13789874783240936517E-01;
    w(143) = 0.13745093443001896632E-01;
    w(144) = 0.13697302631990716258E-01;
    w(145) = 0.13646518102571291428E-01;
    w(146) = 0.13592756614812395910E-01;
    w(147) = 0.13536035934956213614E-01;
    w(148) = 0.13476374833816515982E-01;
    w(149) = 0.13413793085110098513E-01;
    w(150) = 0.13348311463725179953E-01;
    w(151) = 0.13279951743930530650E-01;
    w(152) = 0.13208736697529129966E-01;
    w(153) = 0.13134690091960152836E-01;
    w(154) = 0.13057836688353048840E-01;
    w(155) = 0.12978202239537399286E-01;
    w(156) = 0.12895813488012114694E-01;
    w(157) = 0.12810698163877361967E-01;
    w(158) = 0.12722884982732382906E-01;
    w(159) = 0.12632403643542078765E-01;
    w(160) = 0.12539284826474884353E-01;
    w(161) = 0.12443560190714035263E-01;
    w(162) = 0.12345262372243838455E-01;
    w(163) = 0.12244424981611985899E-01;
    w(164) = 0.12141082601668299679E-01;
    w(165) = 0.12035270785279562630E-01;
    w(166) = 0.11927026053019270040E-01;
    w(167) = 0.11816385890830235763E-01;
    w(168) = 0.11703388747657003101E-01;
    w(169) = 0.11588074033043952568E-01;
    w(170) = 0.11470482114693874380E-01;
    w(171) = 0.11350654315980596602E-01;
    w(172) = 0.11228632913408049354E-01;
    w(173) = 0.11104461134006926537E-01;
    w(174) = 0.10978183152658912470E-01;
    w(175) = 0.10849844089337314099E-01;
    w(176) = 0.10719490006251933623E-01;
    w(177) = 0.10587167904885197931E-01;
    w(178) = 0.10452925722906011926E-01;
    w(179) = 0.10316812330947621682E-01;
    w(180) = 0.10178877529236079733E-01;
    w(181) = 0.10039172044056840798E-01;
    w(182) = 0.98977475240487497440E-02;
    w(183) = 0.97546565363174114611E-02;
    w(184) = 0.96099525623638830097E-02;
    w(185) = 0.94636899938300652943E-02;
    w(186) = 0.93159241280693950932E-02;
    w(187) = 0.91667111635607884067E-02;
    w(188) = 0.90161081951956431600E-02;
    w(189) = 0.88641732094824942641E-02;
    w(190) = 0.87109650797320868736E-02;
    w(191) = 0.85565435613076896192E-02;
    w(192) = 0.84009692870519326354E-02;
    w(193) = 0.82443037630328680306E-02;
    w(194) = 0.80866093647888599710E-02;
    w(195) = 0.79279493342948491103E-02;
    w(196) = 0.77683877779219912200E-02;
    w(197) = 0.76079896657190565832E-02;
    w(198) = 0.74468208324075910174E-02;
    w(199) = 0.72849479805538070639E-02;
    w(200) = 0.71224386864583871532E-02;
    w(201) = 0.69593614093904229394E-02;
    w(202) = 0.67957855048827733948E-02;
    w(203) = 0.66317812429018878941E-02;
    w(204) = 0.64674198318036867274E-02;
    w(205) = 0.63027734490857587172E-02;
    w(206) = 0.61379152800413850435E-02;
    w(207) = 0.59729195655081658049E-02;
    w(208) = 0.58078616599775673635E-02;
    w(209) = 0.56428181013844441585E-02;
    w(210) = 0.54778666939189508240E-02;
    w(211) = 0.53130866051870565663E-02;
    w(212) = 0.51485584789781777618E-02;
    w(213) = 0.49843645647655386012E-02;
    w(214) = 0.48205888648512683476E-02;
    w(215) = 0.46573172997568547773E-02;
    w(216) = 0.44946378920320678616E-02;
    w(217) = 0.43326409680929828545E-02;
    w(218) = 0.41714193769840788528E-02;
    w(219) = 0.40110687240750233989E-02;
    w(220) = 0.38516876166398709241E-02;
    w(221) = 0.36933779170256508183E-02;
    w(222) = 0.35362449977167777340E-02;
    w(223) = 0.33803979910869203823E-02;
    w(224) = 0.32259500250878684614E-02;
    w(225) = 0.30730184347025783234E-02;
    w(226) = 0.29217249379178197538E-02;
    w(227) = 0.27721957645934509940E-02;
    w(228) = 0.26245617274044295626E-02;
    w(229) = 0.24789582266575679307E-02;
    w(230) = 0.23355251860571608737E-02;
    w(231) = 0.21944069253638388388E-02;
    w(232) = 0.20557519893273465236E-02;
    w(233) = 0.19197129710138724125E-02;
    w(234) = 0.17864463917586498247E-02;
    w(235) = 0.16561127281544526052E-02;
    w(236) = 0.15288767050877655684E-02;
    w(237) = 0.14049079956551446427E-02;
    w(238) = 0.12843824718970101768E-02;
    w(239) = 0.11674841174299594077E-02;
    w(240) = 0.10544076228633167722E-02;
    w(241) = 0.94536151685852538246E-03;
    w(242) = 0.84057143271072246365E-03;
    w(243) = 0.74028280424450333046E-03;
    w(244) = 0.64476204130572477933E-03;
    w(245) = 0.55429531493037471492E-03;
    w(246) = 0.46918492424785040975E-03;
    w(247) = 0.38974528447328229322E-03;
    w(248) = 0.31630366082226447689E-03;
    w(249) = 0.24921240048299729402E-03;
    w(250) = 0.18887326450650491366E-03;
    w(251) = 0.13575491094922871973E-03;
    w(252) = 0.90372734658751149261E-04;
    w(253) = 0.53275293669780613125E-04;
    w(254) = 0.25157870384280661489E-04;
    w(255) = 0.69379364324108267170E-05;

  elseif ( n == 511 )

    x(  1) = -0.999999672956734384381;
    x(  2) = -0.999997596379748464620;
    x(  3) = -0.999992298136257588028;
    x(  4) = -0.999982430354891598580;
    x(  5) = -0.999966730098486276883;
    x(  6) = -0.999943996207054375764;
    x(  7) = -0.999913081144678282800;
    x(  8) = -0.999872888120357611938;
    x(  9) = -0.999822363679787739196;
    x( 10) = -0.999760490924432047330;
    x( 11) = -0.999686286448317731776;
    x( 12) = -0.999598799671910683252;
    x( 13) = -0.999497112467187190535;
    x( 14) = -0.999380338025023581928;
    x( 15) = -0.999247618943342473599;
    x( 16) = -0.999098124967667597662;
    x( 17) = -0.998931050830810562236;
    x( 18) = -0.998745614468095114704;
    x( 19) = -0.998541055697167906027;
    x( 20) = -0.998316635318407392531;
    x( 21) = -0.998071634524930323302;
    x( 22) = -0.997805354495957274562;
    x( 23) = -0.997517116063472399965;
    x( 24) = -0.997206259372221959076;
    x( 25) = -0.996872143485260161299;
    x( 26) = -0.996514145914890273849;
    x( 27) = -0.996131662079315037786;
    x( 28) = -0.995724104698407188509;
    x( 29) = -0.995290903148810302261;
    x( 30) = -0.994831502800621000519;
    x( 31) = -0.994345364356723405931;
    x( 32) = -0.993831963212755022209;
    x( 33) = -0.993290788851684966211;
    x( 34) = -0.992721344282788615328;
    x( 35) = -0.992123145530863117683;
    x( 36) = -0.991495721178106132399;
    x( 37) = -0.990838611958294243677;
    x( 38) = -0.990151370400770159181;
    x( 39) = -0.989433560520240838716;
    x( 40) = -0.988684757547429479939;
    x( 41) = -0.987904547695124280467;
    x( 42) = -0.987092527954034067190;
    x( 43) = -0.986248305913007552681;
    x( 44) = -0.985371499598520371114;
    x( 45) = -0.984461737328814534596;
    x( 46) = -0.983518657578632728762;
    x( 47) = -0.982541908851080604251;
    x( 48) = -0.981531149553740106867;
    x( 49) = -0.980486047876721339416;
    x( 50) = -0.979406281670862683806;
    x( 51) = -0.978291538324758539526;
    x( 52) = -0.977141514639705714156;
    x( 53) = -0.975955916702011753129;
    x( 54) = -0.974734459752402667761;
    x( 55) = -0.973476868052506926773;
    x( 56) = -0.972182874748581796578;
    x( 57) = -0.970852221732792443256;
    x( 58) = -0.969484659502459231771;
    x( 59) = -0.968079947017759947964;
    x( 60) = -0.966637851558416567092;
    x( 61) = -0.965158148579915665979;
    x( 62) = -0.963640621569812132521;
    x( 63) = -0.962085061904651475741;
    x( 64) = -0.960491268708020283423;
    x( 65) = -0.958859048710200221356;
    x( 66) = -0.957188216109860962736;
    x( 67) = -0.955478592438183697574;
    x( 68) = -0.953730006425761136415;
    x( 69) = -0.951942293872573589498;
    x( 70) = -0.950115297521294876558;
    x( 71) = -0.948248866934137357063;
    x( 72) = -0.946342858373402905148;
    x( 73) = -0.944397134685866648591;
    x( 74) = -0.942411565191083059813;
    x( 75) = -0.940386025573669721370;
    x( 76) = -0.938320397779592883655;
    x( 77) = -0.936214569916450806625;
    x( 78) = -0.934068436157725787999;
    x( 79) = -0.931881896650953639345;
    x( 80) = -0.929654857429740056670;
    x( 81) = -0.927387230329536696843;
    x( 82) = -0.925078932907075652364;
    x( 83) = -0.922729888363349241523;
    x( 84) = -0.920340025470012420730;
    x( 85) = -0.917909278499077501636;
    x( 86) = -0.915437587155765040644;
    x( 87) = -0.912924896514370590080;
    x( 88) = -0.910371156957004292498;
    x( 89) = -0.907776324115058903624;
    x( 90) = -0.905140358813261595189;
    x( 91) = -0.902463227016165675048;
    x( 92) = -0.899744899776940036639;
    x( 93) = -0.896985353188316590376;
    x( 94) = -0.894184568335559022859;
    x( 95) = -0.891342531251319871666;
    x( 96) = -0.888459232872256998890;
    x( 97) = -0.885534668997285008926;
    x( 98) = -0.882568840247341906842;
    x( 99) = -0.879561752026556262568;
    x(100) = -0.876513414484705269742;
    x(101) = -0.873423842480859310192;
    x(102) = -0.870293055548113905851;
    x(103) = -0.867121077859315215614;
    x(104) = -0.863907938193690477146;
    x(105) = -0.860653669904299969802;
    x(106) = -0.857358310886232156525;
    x(107) = -0.854021903545468625813;
    x(108) = -0.850644494768350279758;
    x(109) = -0.847226135891580884381;
    x(110) = -0.843766882672708601038;
    x(111) = -0.840266795261030442350;
    x(112) = -0.836725938168868735503;
    x(113) = -0.833144380243172624728;
    x(114) = -0.829522194637401400178;
    x(115) = -0.825859458783650001088;
    x(116) = -0.822156254364980407373;
    x(117) = -0.818412667287925807395;
    x(118) = -0.814628787655137413436;
    x(119) = -0.810804709738146594361;
    x(120) = -0.806940531950217611856;
    x(121) = -0.803036356819268687782;
    x(122) = -0.799092290960841401800;
    x(123) = -0.795108445051100526780;
    x(124) = -0.791084933799848361435;
    x(125) = -0.787021875923539422170;
    x(126) = -0.782919394118283016385;
    x(127) = -0.778777615032822744702;
    x(128) = -0.774596669241483377036;
    x(129) = -0.770376691217076824278;
    x(130) = -0.766117819303760090717;
    x(131) = -0.761820195689839149173;
    x(132) = -0.757483966380513637926;
    x(133) = -0.753109281170558142523;
    x(134) = -0.748696293616936602823;
    x(135) = -0.744245161011347082309;
    x(136) = -0.739756044352694758677;
    x(137) = -0.735229108319491547663;
    x(138) = -0.730664521242181261329;
    x(139) = -0.726062455075389632685;
    x(140) = -0.721423085370098915485;
    x(141) = -0.716746591245747095767;
    x(142) = -0.712033155362252034587;
    x(143) = -0.707282963891961103412;
    x(144) = -0.702496206491527078610;
    x(145) = -0.697673076273711232906;
    x(146) = -0.692813769779114702895;
    x(147) = -0.687918486947839325756;
    x(148) = -0.682987431091079228087;
    x(149) = -0.678020808862644517838;
    x(150) = -0.673018830230418479199;
    x(151) = -0.667981708447749702165;
    x(152) = -0.662909660024780595461;
    x(153) = -0.657802904699713735422;
    x(154) = -0.652661665410017496101;
    x(155) = -0.647486168263572388782;
    x(156) = -0.642276642509759513774;
    x(157) = -0.637033320510492495071;
    x(158) = -0.631756437711194230414;
    x(159) = -0.626446232611719746542;
    x(160) = -0.621102946737226402941;
    x(161) = -0.615726824608992638014;
    x(162) = -0.610318113715186400156;
    x(163) = -0.604877064481584353319;
    x(164) = -0.599403930242242892974;
    x(165) = -0.593898967210121954393;
    x(166) = -0.588362434447662541434;
    x(167) = -0.582794593837318850840;
    x(168) = -0.577195710052045814844;
    x(169) = -0.571566050525742833992;
    x(170) = -0.565905885423654422623;
    x(171) = -0.560215487612728441818;
    x(172) = -0.554495132631932548866;
    x(173) = -0.548745098662529448608;
    x(174) = -0.542965666498311490492;
    x(175) = -0.537157119515795115982;
    x(176) = -0.531319743644375623972;
    x(177) = -0.525453827336442687395;
    x(178) = -0.519559661537457021993;
    x(179) = -0.513637539655988578507;
    x(180) = -0.507687757533716602155;
    x(181) = -0.501710613415391878251;
    x(182) = -0.495706407918761460170;
    x(183) = -0.489675444004456155436;
    x(184) = -0.483618026945841027562;
    x(185) = -0.477534464298829155284;
    x(186) = -0.471425065871658876934;
    x(187) = -0.465290143694634735858;
    x(188) = -0.459130011989832332874;
    x(189) = -0.452944987140767283784;
    x(190) = -0.446735387662028473742;
    x(191) = -0.440501534168875795783;
    x(192) = -0.434243749346802558002;
    x(193) = -0.427962357921062742583;
    x(194) = -0.421657686626163300056;
    x(195) = -0.415330064175321663764;
    x(196) = -0.408979821229888672409;
    x(197) = -0.402607290368737092671;
    x(198) = -0.396212806057615939183;
    x(199) = -0.389796704618470795479;
    x(200) = -0.383359324198730346916;
    x(201) = -0.376901004740559344802;
    x(202) = -0.370422087950078230138;
    x(203) = -0.363922917266549655269;
    x(204) = -0.357403837831532152376;
    x(205) = -0.350865196458001209011;
    x(206) = -0.344307341599438022777;
    x(207) = -0.337730623318886219621;
    x(208) = -0.331135393257976833093;
    x(209) = -0.324522004605921855207;
    x(210) = -0.317890812068476683182;
    x(211) = -0.311242171836871800300;
    x(212) = -0.304576441556714043335;
    x(213) = -0.297893980296857823437;
    x(214) = -0.291195148518246681964;
    x(215) = -0.284480308042725577496;
    x(216) = -0.277749822021824315065;
    x(217) = -0.271004054905512543536;
    x(218) = -0.264243372410926761945;
    x(219) = -0.257468141491069790481;
    x(220) = -0.250678730303483176613;
    x(221) = -0.243875508178893021593;
    x(222) = -0.237058845589829727213;
    x(223) = -0.230229114119222177156;
    x(224) = -0.223386686428966881628;
    x(225) = -0.216531936228472628081;
    x(226) = -0.209665238243181194766;
    x(227) = -0.202786968183064697557;
    x(228) = -0.195897502711100153915;
    x(229) = -0.188997219411721861059;
    x(230) = -0.182086496759252198246;
    x(231) = -0.175165714086311475707;
    x(232) = -0.168235251552207464982;
    x(233) = -0.161295490111305257361;
    x(234) = -0.154346811481378108692;
    x(235) = -0.147389598111939940054;
    x(236) = -0.140424233152560174594;
    x(237) = -0.133451100421161601344;
    x(238) = -0.126470584372301966851;
    x(239) = -0.119483070065440005133;
    x(240) = -0.112488943133186625746;
    x(241) = -0.105488589749541988533;
    x(242) = -0.984823965981192020903E-01;
    x(243) = -0.914707508403553909095E-01;
    x(244) = -0.844540400837108837102E-01;
    x(245) = -0.774326523498572825675E-01;
    x(246) = -0.704069760428551790633E-01;
    x(247) = -0.633773999173222898797E-01;
    x(248) = -0.563443130465927899720E-01;
    x(249) = -0.493081047908686267156E-01;
    x(250) = -0.422691647653636032124E-01;
    x(251) = -0.352278828084410232603E-01;
    x(252) = -0.281846489497456943394E-01;
    x(253) = -0.211398533783310883350E-01;
    x(254) = -0.140938864107824626142E-01;
    x(255) = -0.704713845933674648514E-02;
    x(256) = +0.000000000000000000000;
    x(257) = +0.704713845933674648514E-02;
    x(258) = +0.140938864107824626142E-01;
    x(259) = +0.211398533783310883350E-01;
    x(260) = +0.281846489497456943394E-01;
    x(261) = +0.352278828084410232603E-01;
    x(262) = +0.422691647653636032124E-01;
    x(263) = +0.493081047908686267156E-01;
    x(264) = +0.563443130465927899720E-01;
    x(265) = +0.633773999173222898797E-01;
    x(266) = +0.704069760428551790633E-01;
    x(267) = +0.774326523498572825675E-01;
    x(268) = +0.844540400837108837102E-01;
    x(269) = +0.914707508403553909095E-01;
    x(270) = +0.984823965981192020903E-01;
    x(271) = +0.105488589749541988533;
    x(272) = +0.112488943133186625746;
    x(273) = +0.119483070065440005133;
    x(274) = +0.126470584372301966851;
    x(275) = +0.133451100421161601344;
    x(276) = +0.140424233152560174594;
    x(277) = +0.147389598111939940054;
    x(278) = +0.154346811481378108692;
    x(279) = +0.161295490111305257361;
    x(280) = +0.168235251552207464982;
    x(281) = +0.175165714086311475707;
    x(282) = +0.182086496759252198246;
    x(283) = +0.188997219411721861059;
    x(284) = +0.195897502711100153915;
    x(285) = +0.202786968183064697557;
    x(286) = +0.209665238243181194766;
    x(287) = +0.216531936228472628081;
    x(288) = +0.223386686428966881628;
    x(289) = +0.230229114119222177156;
    x(290) = +0.237058845589829727213;
    x(291) = +0.243875508178893021593;
    x(292) = +0.250678730303483176613;
    x(293) = +0.257468141491069790481;
    x(294) = +0.264243372410926761945;
    x(295) = +0.271004054905512543536;
    x(296) = +0.277749822021824315065;
    x(297) = +0.284480308042725577496;
    x(298) = +0.291195148518246681964;
    x(299) = +0.297893980296857823437;
    x(300) = +0.304576441556714043335;
    x(301) = +0.311242171836871800300;
    x(302) = +0.317890812068476683182;
    x(303) = +0.324522004605921855207;
    x(304) = +0.331135393257976833093;
    x(305) = +0.337730623318886219621;
    x(306) = +0.344307341599438022777;
    x(307) = +0.350865196458001209011;
    x(308) = +0.357403837831532152376;
    x(309) = +0.363922917266549655269;
    x(310) = +0.370422087950078230138;
    x(311) = +0.376901004740559344802;
    x(312) = +0.383359324198730346916;
    x(313) = +0.389796704618470795479;
    x(314) = +0.396212806057615939183;
    x(315) = +0.402607290368737092671;
    x(316) = +0.408979821229888672409;
    x(317) = +0.415330064175321663764;
    x(318) = +0.421657686626163300056;
    x(319) = +0.427962357921062742583;
    x(320) = +0.434243749346802558002;
    x(321) = +0.440501534168875795783;
    x(322) = +0.446735387662028473742;
    x(323) = +0.452944987140767283784;
    x(324) = +0.459130011989832332874;
    x(325) = +0.465290143694634735858;
    x(326) = +0.471425065871658876934;
    x(327) = +0.477534464298829155284;
    x(328) = +0.483618026945841027562;
    x(329) = +0.489675444004456155436;
    x(330) = +0.495706407918761460170;
    x(331) = +0.501710613415391878251;
    x(332) = +0.507687757533716602155;
    x(333) = +0.513637539655988578507;
    x(334) = +0.519559661537457021993;
    x(335) = +0.525453827336442687395;
    x(336) = +0.531319743644375623972;
    x(337) = +0.537157119515795115982;
    x(338) = +0.542965666498311490492;
    x(339) = +0.548745098662529448608;
    x(340) = +0.554495132631932548866;
    x(341) = +0.560215487612728441818;
    x(342) = +0.565905885423654422623;
    x(343) = +0.571566050525742833992;
    x(344) = +0.577195710052045814844;
    x(345) = +0.582794593837318850840;
    x(346) = +0.588362434447662541434;
    x(347) = +0.593898967210121954393;
    x(348) = +0.599403930242242892974;
    x(349) = +0.604877064481584353319;
    x(350) = +0.610318113715186400156;
    x(351) = +0.615726824608992638014;
    x(352) = +0.621102946737226402941;
    x(353) = +0.626446232611719746542;
    x(354) = +0.631756437711194230414;
    x(355) = +0.637033320510492495071;
    x(356) = +0.642276642509759513774;
    x(357) = +0.647486168263572388782;
    x(358) = +0.652661665410017496101;
    x(359) = +0.657802904699713735422;
    x(360) = +0.662909660024780595461;
    x(361) = +0.667981708447749702165;
    x(362) = +0.673018830230418479199;
    x(363) = +0.678020808862644517838;
    x(364) = +0.682987431091079228087;
    x(365) = +0.687918486947839325756;
    x(366) = +0.692813769779114702895;
    x(367) = +0.697673076273711232906;
    x(368) = +0.702496206491527078610;
    x(369) = +0.707282963891961103412;
    x(370) = +0.712033155362252034587;
    x(371) = +0.716746591245747095767;
    x(372) = +0.721423085370098915485;
    x(373) = +0.726062455075389632685;
    x(374) = +0.730664521242181261329;
    x(375) = +0.735229108319491547663;
    x(376) = +0.739756044352694758677;
    x(377) = +0.744245161011347082309;
    x(378) = +0.748696293616936602823;
    x(379) = +0.753109281170558142523;
    x(380) = +0.757483966380513637926;
    x(381) = +0.761820195689839149173;
    x(382) = +0.766117819303760090717;
    x(383) = +0.770376691217076824278;
    x(384) = +0.774596669241483377036;
    x(385) = +0.778777615032822744702;
    x(386) = +0.782919394118283016385;
    x(387) = +0.787021875923539422170;
    x(388) = +0.791084933799848361435;
    x(389) = +0.795108445051100526780;
    x(390) = +0.799092290960841401800;
    x(391) = +0.803036356819268687782;
    x(392) = +0.806940531950217611856;
    x(393) = +0.810804709738146594361;
    x(394) = +0.814628787655137413436;
    x(395) = +0.818412667287925807395;
    x(396) = +0.822156254364980407373;
    x(397) = +0.825859458783650001088;
    x(398) = +0.829522194637401400178;
    x(399) = +0.833144380243172624728;
    x(400) = +0.836725938168868735503;
    x(401) = +0.840266795261030442350;
    x(402) = +0.843766882672708601038;
    x(403) = +0.847226135891580884381;
    x(404) = +0.850644494768350279758;
    x(405) = +0.854021903545468625813;
    x(406) = +0.857358310886232156525;
    x(407) = +0.860653669904299969802;
    x(408) = +0.863907938193690477146;
    x(409) = +0.867121077859315215614;
    x(410) = +0.870293055548113905851;
    x(411) = +0.873423842480859310192;
    x(412) = +0.876513414484705269742;
    x(413) = +0.879561752026556262568;
    x(414) = +0.882568840247341906842;
    x(415) = +0.885534668997285008926;
    x(416) = +0.888459232872256998890;
    x(417) = +0.891342531251319871666;
    x(418) = +0.894184568335559022859;
    x(419) = +0.896985353188316590376;
    x(420) = +0.899744899776940036639;
    x(421) = +0.902463227016165675048;
    x(422) = +0.905140358813261595189;
    x(423) = +0.907776324115058903624;
    x(424) = +0.910371156957004292498;
    x(425) = +0.912924896514370590080;
    x(426) = +0.915437587155765040644;
    x(427) = +0.917909278499077501636;
    x(428) = +0.920340025470012420730;
    x(429) = +0.922729888363349241523;
    x(430) = +0.925078932907075652364;
    x(431) = +0.927387230329536696843;
    x(432) = +0.929654857429740056670;
    x(433) = +0.931881896650953639345;
    x(434) = +0.934068436157725787999;
    x(435) = +0.936214569916450806625;
    x(436) = +0.938320397779592883655;
    x(437) = +0.940386025573669721370;
    x(438) = +0.942411565191083059813;
    x(439) = +0.944397134685866648591;
    x(440) = +0.946342858373402905148;
    x(441) = +0.948248866934137357063;
    x(442) = +0.950115297521294876558;
    x(443) = +0.951942293872573589498;
    x(444) = +0.953730006425761136415;
    x(445) = +0.955478592438183697574;
    x(446) = +0.957188216109860962736;
    x(447) = +0.958859048710200221356;
    x(448) = +0.960491268708020283423;
    x(449) = +0.962085061904651475741;
    x(450) = +0.963640621569812132521;
    x(451) = +0.965158148579915665979;
    x(452) = +0.966637851558416567092;
    x(453) = +0.968079947017759947964;
    x(454) = +0.969484659502459231771;
    x(455) = +0.970852221732792443256;
    x(456) = +0.972182874748581796578;
    x(457) = +0.973476868052506926773;
    x(458) = +0.974734459752402667761;
    x(459) = +0.975955916702011753129;
    x(460) = +0.977141514639705714156;
    x(461) = +0.978291538324758539526;
    x(462) = +0.979406281670862683806;
    x(463) = +0.980486047876721339416;
    x(464) = +0.981531149553740106867;
    x(465) = +0.982541908851080604251;
    x(466) = +0.983518657578632728762;
    x(467) = +0.984461737328814534596;
    x(468) = +0.985371499598520371114;
    x(469) = +0.986248305913007552681;
    x(470) = +0.987092527954034067190;
    x(471) = +0.987904547695124280467;
    x(472) = +0.988684757547429479939;
    x(473) = +0.989433560520240838716;
    x(474) = +0.990151370400770159181;
    x(475) = +0.990838611958294243677;
    x(476) = +0.991495721178106132399;
    x(477) = +0.992123145530863117683;
    x(478) = +0.992721344282788615328;
    x(479) = +0.993290788851684966211;
    x(480) = +0.993831963212755022209;
    x(481) = +0.994345364356723405931;
    x(482) = +0.994831502800621000519;
    x(483) = +0.995290903148810302261;
    x(484) = +0.995724104698407188509;
    x(485) = +0.996131662079315037786;
    x(486) = +0.996514145914890273849;
    x(487) = +0.996872143485260161299;
    x(488) = +0.997206259372221959076;
    x(489) = +0.997517116063472399965;
    x(490) = +0.997805354495957274562;
    x(491) = +0.998071634524930323302;
    x(492) = +0.998316635318407392531;
    x(493) = +0.998541055697167906027;
    x(494) = +0.998745614468095114704;
    x(495) = +0.998931050830810562236;
    x(496) = +0.999098124967667597662;
    x(497) = +0.999247618943342473599;
    x(498) = +0.999380338025023581928;
    x(499) = +0.999497112467187190535;
    x(500) = +0.999598799671910683252;
    x(501) = +0.999686286448317731776;
    x(502) = +0.999760490924432047330;
    x(503) = +0.999822363679787739196;
    x(504) = +0.999872888120357611938;
    x(505) = +0.999913081144678282800;
    x(506) = +0.999943996207054375764;
    x(507) = +0.999966730098486276883;
    x(508) = +0.999982430354891598580;
    x(509) = +0.999992298136257588028;
    x(510) = +0.999997596379748464620;
    x(511) = +0.999999672956734384381;

    w(  1) = 0.945715933950007048827E-06;
    w(  2) = 0.345456507169149134898E-05;
    w(  3) = 0.736624069102321668857E-05;
    w(  4) = 0.125792781889592743525E-04;
    w(  5) = 0.190213681905875816679E-04;
    w(  6) = 0.266376412339000901358E-04;
    w(  7) = 0.353751372055189588628E-04;
    w(  8) = 0.451863674126296143105E-04;
    w(  9) = 0.560319507856164252140E-04;
    w( 10) = 0.678774554733972416227E-04;
    w( 11) = 0.806899228014035293851E-04;
    w( 12) = 0.944366322532705527066E-04;
    w( 13) = 0.109085545645741522051E-03;
    w( 14) = 0.124606200241498368482E-03;
    w( 15) = 0.140970302204104791413E-03;
    w( 16) = 0.158151830411132242924E-03;
    w( 17) = 0.176126765545083195474E-03;
    w( 18) = 0.194872642236641146532E-03;
    w( 19) = 0.214368090034216937149E-03;
    w( 20) = 0.234592462123925204879E-03;
    w( 21) = 0.255525589595236862014E-03;
    w( 22) = 0.277147657465187357459E-03;
    w( 23) = 0.299439176850911730874E-03;
    w( 24) = 0.322381020652862389664E-03;
    w( 25) = 0.345954492129903871350E-03;
    w( 26) = 0.370141402122251665232E-03;
    w( 27) = 0.394924138246873704434E-03;
    w( 28) = 0.420285716355361231823E-03;
    w( 29) = 0.446209810101403247488E-03;
    w( 30) = 0.472680758429262691232E-03;
    w( 31) = 0.499683553312800484519E-03;
    w( 32) = 0.527203811431658386125E-03;
    w( 33) = 0.555227733977307579715E-03;
    w( 34) = 0.583742058714979703847E-03;
    w( 35) = 0.612734008012225209294E-03;
    w( 36) = 0.642191235948505088403E-03;
    w( 37) = 0.672101776960108194646E-03;
    w( 38) = 0.702453997827572321358E-03;
    w( 39) = 0.733236554224767912055E-03;
    w( 40) = 0.764438352543882784191E-03;
    w( 41) = 0.796048517297550871506E-03;
    w( 42) = 0.828056364077226302608E-03;
    w( 43) = 0.860451377808527848128E-03;
    w( 44) = 0.893223195879324912340E-03;
    w( 45) = 0.926361595613111283368E-03;
    w( 46) = 0.959856485506936206261E-03;
    w( 47) = 0.993697899638760857945E-03;
    w( 48) = 0.102787599466367326179E-02;
    w( 49) = 0.106238104885340071375E-02;
    w( 50) = 0.109720346268191941940E-02;
    w( 51) = 0.113233376051597664917E-02;
    w( 52) = 0.116776259302858043685E-02;
    w( 53) = 0.120348074001265964881E-02;
    w( 54) = 0.123947911332878396534E-02;
    w( 55) = 0.127574875977346947345E-02;
    w( 56) = 0.131228086370221478128E-02;
    w( 57) = 0.134906674928353113127E-02;
    w( 58) = 0.138609788229672549700E-02;
    w( 59) = 0.142336587141720519900E-02;
    w( 60) = 0.146086246895890987689E-02;
    w( 61) = 0.149857957106456636214E-02;
    w( 62) = 0.153650921735128916170E-02;
    w( 63) = 0.157464359003212166189E-02;
    w( 64) = 0.161297501254393423070E-02;
    w( 65) = 0.165149594771914570655E-02;
    w( 66) = 0.169019899554346019117E-02;
    w( 67) = 0.172907689054461607168E-02;
    w( 68) = 0.176812249885838886701E-02;
    w( 69) = 0.180732881501808930079E-02;
    w( 70) = 0.184668895851282540913E-02;
    w( 71) = 0.188619617015808475394E-02;
    w( 72) = 0.192584380831993546204E-02;
    w( 73) = 0.196562534503150547732E-02;
    w( 74) = 0.200553436203751169944E-02;
    w( 75) = 0.204556454679958293446E-02;
    w( 76) = 0.208570968849203942640E-02;
    w( 77) = 0.212596367401472533045E-02;
    w( 78) = 0.216632048404649142727E-02;
    w( 79) = 0.220677418916003329194E-02;
    w( 80) = 0.224731894601603393082E-02;
    w( 81) = 0.228794899365195972378E-02;
    w( 82) = 0.232865864987842738864E-02;
    w( 83) = 0.236944230779380495146E-02;
    w( 84) = 0.241029443242563417382E-02;
    w( 85) = 0.245120955750556483923E-02;
    w( 86) = 0.249218228238276930060E-02;
    w( 87) = 0.253320726907925325750E-02;
    w( 88) = 0.257427923948908888092E-02;
    w( 89) = 0.261539297272236109225E-02;
    w( 90) = 0.265654330259352828314E-02;
    w( 91) = 0.269772511525294586667E-02;
    w( 92) = 0.273893334695947541201E-02;
    w( 93) = 0.278016298199139435045E-02;
    w( 94) = 0.282140905069222207923E-02;
    w( 95) = 0.286266662764757868253E-02;
    w( 96) = 0.290393082998878368175E-02;
    w( 97) = 0.294519681581857582284E-02;
    w( 98) = 0.298645978275408290247E-02;
    w( 99) = 0.302771496658198544480E-02;
    w(100) = 0.306895764002069252174E-02;
    w(101) = 0.311018311158427546158E-02;
    w(102) = 0.315138672454287935858E-02;
    w(103) = 0.319256385597434736790E-02;
    w(104) = 0.323370991590184336368E-02;
    w(105) = 0.327482034651233969564E-02;
    w(106) = 0.331589062145094394706E-02;
    w(107) = 0.335691624518616761342E-02;
    w(108) = 0.339789275244138669739E-02;
    w(109) = 0.343881570768790591876E-02;
    w(110) = 0.347968070469521146972E-02;
    w(111) = 0.352048336613417922682E-02;
    w(112) = 0.356121934322919357659E-02;
    w(113) = 0.360188431545532431869E-02;
    w(114) = 0.364247399027690353194E-02;
    w(115) = 0.368298410292403911967E-02;
    w(116) = 0.372341041620379550870E-02;
    w(117) = 0.376374872034296338241E-02;
    w(118) = 0.380399483285952829161E-02;
    w(119) = 0.384414459846013158917E-02;
    w(120) = 0.388419388896099560998E-02;
    w(121) = 0.392413860322995774660E-02;
    w(122) = 0.396397466714742455513E-02;
    w(123) = 0.400369803358421688562E-02;
    w(124) = 0.404330468239442998549E-02;
    w(125) = 0.408279062042157838350E-02;
    w(126) = 0.412215188151643401528E-02;
    w(127) = 0.416138452656509745764E-02;
    w(128) = 0.420048464352596631772E-02;
    w(129) = 0.423944834747438184434E-02;
    w(130) = 0.427827178065384480959E-02;
    w(131) = 0.431695111253279479928E-02;
    w(132) = 0.435548253986604343679E-02;
    w(133) = 0.439386228676004195260E-02;
    w(134) = 0.443208660474124713206E-02;
    w(135) = 0.447015177282692726900E-02;
    w(136) = 0.450805409759782158001E-02;
    w(137) = 0.454578991327213285488E-02;
    w(138) = 0.458335558178039420335E-02;
    w(139) = 0.462074749284080687482E-02;
    w(140) = 0.465796206403469754658E-02;
    w(141) = 0.469499574088179046532E-02;
    w(142) = 0.473184499691503264714E-02;
    w(143) = 0.476850633375474925263E-02;
    w(144) = 0.480497628118194150483E-02;
    w(145) = 0.484125139721057135214E-02;
    w(146) = 0.487732826815870573054E-02;
    w(147) = 0.491320350871841897367E-02;
    w(148) = 0.494887376202437487201E-02;
    w(149) = 0.498433569972103029914E-02;
    w(150) = 0.501958602202842039909E-02;
    w(151) = 0.505462145780650125058E-02;
    w(152) = 0.508943876461803986674E-02;
    w(153) = 0.512403472879005351831E-02;
    w(154) = 0.515840616547381084096E-02;
    w(155) = 0.519254991870341614863E-02;
    w(156) = 0.522646286145300596306E-02;
    w(157) = 0.526014189569259311205E-02;
    w(158) = 0.529358395244259896547E-02;
    w(159) = 0.532678599182711857974E-02;
    w(160) = 0.535974500312596681161E-02;
    w(161) = 0.539245800482555593606E-02;
    w(162) = 0.542492204466865704951E-02;
    w(163) = 0.545713419970309863995E-02;
    w(164) = 0.548909157632945623482E-02;
    w(165) = 0.552079131034778706457E-02;
    w(166) = 0.555223056700346326850E-02;
    w(167) = 0.558340654103215637610E-02;
    w(168) = 0.561431645670402467678E-02;
    w(169) = 0.564495756786715368885E-02;
    w(170) = 0.567532715799029830087E-02;
    w(171) = 0.570542254020497332312E-02;
    w(172) = 0.573524105734693719020E-02;
    w(173) = 0.576478008199711142954E-02;
    w(174) = 0.579403701652197628421E-02;
    w(175) = 0.582300929311348057702E-02;
    w(176) = 0.585169437382850155033E-02;
    w(177) = 0.588008975062788803205E-02;
    w(178) = 0.590819294541511788161E-02;
    w(179) = 0.593600151007459827614E-02;
    w(180) = 0.596351302650963502011E-02;
    w(181) = 0.599072510668009471472E-02;
    w(182) = 0.601763539263978131522E-02;
    w(183) = 0.604424155657354634589E-02;
    w(184) = 0.607054130083414983949E-02;
    w(185) = 0.609653235797888692923E-02;
    w(186) = 0.612221249080599294931E-02;
    w(187) = 0.614757949239083790214E-02;
    w(188) = 0.617263118612191922727E-02;
    w(189) = 0.619736542573665996342E-02;
    w(190) = 0.622178009535701763157E-02;
    w(191) = 0.624587310952490748541E-02;
    w(192) = 0.626964241323744217671E-02;
    w(193) = 0.629308598198198836688E-02;
    w(194) = 0.631620182177103938227E-02;
    w(195) = 0.633898796917690165912E-02;
    w(196) = 0.636144249136619145314E-02;
    w(197) = 0.638356348613413709795E-02;
    w(198) = 0.640534908193868098342E-02;
    w(199) = 0.642679743793437438922E-02;
    w(200) = 0.644790674400605734710E-02;
    w(201) = 0.646867522080231481688E-02;
    w(202) = 0.648910111976869964292E-02;
    w(203) = 0.650918272318071200827E-02;
    w(204) = 0.652891834417652442012E-02;
    w(205) = 0.654830632678944064054E-02;
    w(206) = 0.656734504598007641819E-02;
    w(207) = 0.658603290766824937794E-02;
    w(208) = 0.660436834876456498276E-02;
    w(209) = 0.662234983720168509457E-02;
    w(210) = 0.663997587196526532519E-02;
    w(211) = 0.665724498312454708217E-02;
    w(212) = 0.667415573186258997654E-02;
    w(213) = 0.669070671050613006584E-02;
    w(214) = 0.670689654255504925648E-02;
    w(215) = 0.672272388271144108036E-02;
    w(216) = 0.673818741690825799086E-02;
    w(217) = 0.675328586233752529078E-02;
    w(218) = 0.676801796747810680683E-02;
    w(219) = 0.678238251212300746082E-02;
    w(220) = 0.679637830740619795480E-02;
    w(221) = 0.681000419582894688374E-02;
    w(222) = 0.682325905128564571420E-02;
    w(223) = 0.683614177908911221841E-02;
    w(224) = 0.684865131599535812903E-02;
    w(225) = 0.686078663022780697951E-02;
    w(226) = 0.687254672150094831613E-02;
    w(227) = 0.688393062104341470995E-02;
    w(228) = 0.689493739162046825872E-02;
    w(229) = 0.690556612755588354803E-02;
    w(230) = 0.691581595475321433825E-02;
    w(231) = 0.692568603071643155621E-02;
    w(232) = 0.693517554456992049848E-02;
    w(233) = 0.694428371707782549438E-02;
    w(234) = 0.695300980066273063177E-02;
    w(235) = 0.696135307942366551493E-02;
    w(236) = 0.696931286915342540213E-02;
    w(237) = 0.697688851735519545845E-02;
    w(238) = 0.698407940325846925786E-02;
    w(239) = 0.699088493783425207545E-02;
    w(240) = 0.699730456380953992594E-02;
    w(241) = 0.700333775568106572820E-02;
    w(242) = 0.700898401972830440494E-02;
    w(243) = 0.701424289402572916425E-02;
    w(244) = 0.701911394845431165171E-02;
    w(245) = 0.702359678471225911031E-02;
    w(246) = 0.702769103632498213858E-02;
    w(247) = 0.703139636865428709508E-02;
    w(248) = 0.703471247890678765907E-02;
    w(249) = 0.703763909614153052319E-02;
    w(250) = 0.704017598127683066242E-02;
    w(251) = 0.704232292709631209597E-02;
    w(252) = 0.704407975825415053266E-02;
    w(253) = 0.704544633127951476780E-02;
    w(254) = 0.704642253458020417748E-02;
    w(255) = 0.704700828844548013730E-02;
    w(256) = 0.704720354504808967346E-02;
    w(257) = 0.704700828844548013730E-02;
    w(258) = 0.704642253458020417748E-02;
    w(259) = 0.704544633127951476780E-02;
    w(260) = 0.704407975825415053266E-02;
    w(261) = 0.704232292709631209597E-02;
    w(262) = 0.704017598127683066242E-02;
    w(263) = 0.703763909614153052319E-02;
    w(264) = 0.703471247890678765907E-02;
    w(265) = 0.703139636865428709508E-02;
    w(266) = 0.702769103632498213858E-02;
    w(267) = 0.702359678471225911031E-02;
    w(268) = 0.701911394845431165171E-02;
    w(269) = 0.701424289402572916425E-02;
    w(270) = 0.700898401972830440494E-02;
    w(271) = 0.700333775568106572820E-02;
    w(272) = 0.699730456380953992594E-02;
    w(273) = 0.699088493783425207545E-02;
    w(274) = 0.698407940325846925786E-02;
    w(275) = 0.697688851735519545845E-02;
    w(276) = 0.696931286915342540213E-02;
    w(277) = 0.696135307942366551493E-02;
    w(278) = 0.695300980066273063177E-02;
    w(279) = 0.694428371707782549438E-02;
    w(280) = 0.693517554456992049848E-02;
    w(281) = 0.692568603071643155621E-02;
    w(282) = 0.691581595475321433825E-02;
    w(283) = 0.690556612755588354803E-02;
    w(284) = 0.689493739162046825872E-02;
    w(285) = 0.688393062104341470995E-02;
    w(286) = 0.687254672150094831613E-02;
    w(287) = 0.686078663022780697951E-02;
    w(288) = 0.684865131599535812903E-02;
    w(289) = 0.683614177908911221841E-02;
    w(290) = 0.682325905128564571420E-02;
    w(291) = 0.681000419582894688374E-02;
    w(292) = 0.679637830740619795480E-02;
    w(293) = 0.678238251212300746082E-02;
    w(294) = 0.676801796747810680683E-02;
    w(295) = 0.675328586233752529078E-02;
    w(296) = 0.673818741690825799086E-02;
    w(297) = 0.672272388271144108036E-02;
    w(298) = 0.670689654255504925648E-02;
    w(299) = 0.669070671050613006584E-02;
    w(300) = 0.667415573186258997654E-02;
    w(301) = 0.665724498312454708217E-02;
    w(302) = 0.663997587196526532519E-02;
    w(303) = 0.662234983720168509457E-02;
    w(304) = 0.660436834876456498276E-02;
    w(305) = 0.658603290766824937794E-02;
    w(306) = 0.656734504598007641819E-02;
    w(307) = 0.654830632678944064054E-02;
    w(308) = 0.652891834417652442012E-02;
    w(309) = 0.650918272318071200827E-02;
    w(310) = 0.648910111976869964292E-02;
    w(311) = 0.646867522080231481688E-02;
    w(312) = 0.644790674400605734710E-02;
    w(313) = 0.642679743793437438922E-02;
    w(314) = 0.640534908193868098342E-02;
    w(315) = 0.638356348613413709795E-02;
    w(316) = 0.636144249136619145314E-02;
    w(317) = 0.633898796917690165912E-02;
    w(318) = 0.631620182177103938227E-02;
    w(319) = 0.629308598198198836688E-02;
    w(320) = 0.626964241323744217671E-02;
    w(321) = 0.624587310952490748541E-02;
    w(322) = 0.622178009535701763157E-02;
    w(323) = 0.619736542573665996342E-02;
    w(324) = 0.617263118612191922727E-02;
    w(325) = 0.614757949239083790214E-02;
    w(326) = 0.612221249080599294931E-02;
    w(327) = 0.609653235797888692923E-02;
    w(328) = 0.607054130083414983949E-02;
    w(329) = 0.604424155657354634589E-02;
    w(330) = 0.601763539263978131522E-02;
    w(331) = 0.599072510668009471472E-02;
    w(332) = 0.596351302650963502011E-02;
    w(333) = 0.593600151007459827614E-02;
    w(334) = 0.590819294541511788161E-02;
    w(335) = 0.588008975062788803205E-02;
    w(336) = 0.585169437382850155033E-02;
    w(337) = 0.582300929311348057702E-02;
    w(338) = 0.579403701652197628421E-02;
    w(339) = 0.576478008199711142954E-02;
    w(340) = 0.573524105734693719020E-02;
    w(341) = 0.570542254020497332312E-02;
    w(342) = 0.567532715799029830087E-02;
    w(343) = 0.564495756786715368885E-02;
    w(344) = 0.561431645670402467678E-02;
    w(345) = 0.558340654103215637610E-02;
    w(346) = 0.555223056700346326850E-02;
    w(347) = 0.552079131034778706457E-02;
    w(348) = 0.548909157632945623482E-02;
    w(349) = 0.545713419970309863995E-02;
    w(350) = 0.542492204466865704951E-02;
    w(351) = 0.539245800482555593606E-02;
    w(352) = 0.535974500312596681161E-02;
    w(353) = 0.532678599182711857974E-02;
    w(354) = 0.529358395244259896547E-02;
    w(355) = 0.526014189569259311205E-02;
    w(356) = 0.522646286145300596306E-02;
    w(357) = 0.519254991870341614863E-02;
    w(358) = 0.515840616547381084096E-02;
    w(359) = 0.512403472879005351831E-02;
    w(360) = 0.508943876461803986674E-02;
    w(361) = 0.505462145780650125058E-02;
    w(362) = 0.501958602202842039909E-02;
    w(363) = 0.498433569972103029914E-02;
    w(364) = 0.494887376202437487201E-02;
    w(365) = 0.491320350871841897367E-02;
    w(366) = 0.487732826815870573054E-02;
    w(367) = 0.484125139721057135214E-02;
    w(368) = 0.480497628118194150483E-02;
    w(369) = 0.476850633375474925263E-02;
    w(370) = 0.473184499691503264714E-02;
    w(371) = 0.469499574088179046532E-02;
    w(372) = 0.465796206403469754658E-02;
    w(373) = 0.462074749284080687482E-02;
    w(374) = 0.458335558178039420335E-02;
    w(375) = 0.454578991327213285488E-02;
    w(376) = 0.450805409759782158001E-02;
    w(377) = 0.447015177282692726900E-02;
    w(378) = 0.443208660474124713206E-02;
    w(379) = 0.439386228676004195260E-02;
    w(380) = 0.435548253986604343679E-02;
    w(381) = 0.431695111253279479928E-02;
    w(382) = 0.427827178065384480959E-02;
    w(383) = 0.423944834747438184434E-02;
    w(384) = 0.420048464352596631772E-02;
    w(385) = 0.416138452656509745764E-02;
    w(386) = 0.412215188151643401528E-02;
    w(387) = 0.408279062042157838350E-02;
    w(388) = 0.404330468239442998549E-02;
    w(389) = 0.400369803358421688562E-02;
    w(390) = 0.396397466714742455513E-02;
    w(391) = 0.392413860322995774660E-02;
    w(392) = 0.388419388896099560998E-02;
    w(393) = 0.384414459846013158917E-02;
    w(394) = 0.380399483285952829161E-02;
    w(395) = 0.376374872034296338241E-02;
    w(396) = 0.372341041620379550870E-02;
    w(397) = 0.368298410292403911967E-02;
    w(398) = 0.364247399027690353194E-02;
    w(399) = 0.360188431545532431869E-02;
    w(400) = 0.356121934322919357659E-02;
    w(401) = 0.352048336613417922682E-02;
    w(402) = 0.347968070469521146972E-02;
    w(403) = 0.343881570768790591876E-02;
    w(404) = 0.339789275244138669739E-02;
    w(405) = 0.335691624518616761342E-02;
    w(406) = 0.331589062145094394706E-02;
    w(407) = 0.327482034651233969564E-02;
    w(408) = 0.323370991590184336368E-02;
    w(409) = 0.319256385597434736790E-02;
    w(410) = 0.315138672454287935858E-02;
    w(411) = 0.311018311158427546158E-02;
    w(412) = 0.306895764002069252174E-02;
    w(413) = 0.302771496658198544480E-02;
    w(414) = 0.298645978275408290247E-02;
    w(415) = 0.294519681581857582284E-02;
    w(416) = 0.290393082998878368175E-02;
    w(417) = 0.286266662764757868253E-02;
    w(418) = 0.282140905069222207923E-02;
    w(419) = 0.278016298199139435045E-02;
    w(420) = 0.273893334695947541201E-02;
    w(421) = 0.269772511525294586667E-02;
    w(422) = 0.265654330259352828314E-02;
    w(423) = 0.261539297272236109225E-02;
    w(424) = 0.257427923948908888092E-02;
    w(425) = 0.253320726907925325750E-02;
    w(426) = 0.249218228238276930060E-02;
    w(427) = 0.245120955750556483923E-02;
    w(428) = 0.241029443242563417382E-02;
    w(429) = 0.236944230779380495146E-02;
    w(430) = 0.232865864987842738864E-02;
    w(431) = 0.228794899365195972378E-02;
    w(432) = 0.224731894601603393082E-02;
    w(433) = 0.220677418916003329194E-02;
    w(434) = 0.216632048404649142727E-02;
    w(435) = 0.212596367401472533045E-02;
    w(436) = 0.208570968849203942640E-02;
    w(437) = 0.204556454679958293446E-02;
    w(438) = 0.200553436203751169944E-02;
    w(439) = 0.196562534503150547732E-02;
    w(440) = 0.192584380831993546204E-02;
    w(441) = 0.188619617015808475394E-02;
    w(442) = 0.184668895851282540913E-02;
    w(443) = 0.180732881501808930079E-02;
    w(444) = 0.176812249885838886701E-02;
    w(445) = 0.172907689054461607168E-02;
    w(446) = 0.169019899554346019117E-02;
    w(447) = 0.165149594771914570655E-02;
    w(448) = 0.161297501254393423070E-02;
    w(449) = 0.157464359003212166189E-02;
    w(450) = 0.153650921735128916170E-02;
    w(451) = 0.149857957106456636214E-02;
    w(452) = 0.146086246895890987689E-02;
    w(453) = 0.142336587141720519900E-02;
    w(454) = 0.138609788229672549700E-02;
    w(455) = 0.134906674928353113127E-02;
    w(456) = 0.131228086370221478128E-02;
    w(457) = 0.127574875977346947345E-02;
    w(458) = 0.123947911332878396534E-02;
    w(459) = 0.120348074001265964881E-02;
    w(460) = 0.116776259302858043685E-02;
    w(461) = 0.113233376051597664917E-02;
    w(462) = 0.109720346268191941940E-02;
    w(463) = 0.106238104885340071375E-02;
    w(464) = 0.102787599466367326179E-02;
    w(465) = 0.993697899638760857945E-03;
    w(466) = 0.959856485506936206261E-03;
    w(467) = 0.926361595613111283368E-03;
    w(468) = 0.893223195879324912340E-03;
    w(469) = 0.860451377808527848128E-03;
    w(470) = 0.828056364077226302608E-03;
    w(471) = 0.796048517297550871506E-03;
    w(472) = 0.764438352543882784191E-03;
    w(473) = 0.733236554224767912055E-03;
    w(474) = 0.702453997827572321358E-03;
    w(475) = 0.672101776960108194646E-03;
    w(476) = 0.642191235948505088403E-03;
    w(477) = 0.612734008012225209294E-03;
    w(478) = 0.583742058714979703847E-03;
    w(479) = 0.555227733977307579715E-03;
    w(480) = 0.527203811431658386125E-03;
    w(481) = 0.499683553312800484519E-03;
    w(482) = 0.472680758429262691232E-03;
    w(483) = 0.446209810101403247488E-03;
    w(484) = 0.420285716355361231823E-03;
    w(485) = 0.394924138246873704434E-03;
    w(486) = 0.370141402122251665232E-03;
    w(487) = 0.345954492129903871350E-03;
    w(488) = 0.322381020652862389664E-03;
    w(489) = 0.299439176850911730874E-03;
    w(490) = 0.277147657465187357459E-03;
    w(491) = 0.255525589595236862014E-03;
    w(492) = 0.234592462123925204879E-03;
    w(493) = 0.214368090034216937149E-03;
    w(494) = 0.194872642236641146532E-03;
    w(495) = 0.176126765545083195474E-03;
    w(496) = 0.158151830411132242924E-03;
    w(497) = 0.140970302204104791413E-03;
    w(498) = 0.124606200241498368482E-03;
    w(499) = 0.109085545645741522051E-03;
    w(500) = 0.944366322532705527066E-04;
    w(501) = 0.806899228014035293851E-04;
    w(502) = 0.678774554733972416227E-04;
    w(503) = 0.560319507856164252140E-04;
    w(504) = 0.451863674126296143105E-04;
    w(505) = 0.353751372055189588628E-04;
    w(506) = 0.266376412339000901358E-04;
    w(507) = 0.190213681905875816679E-04;
    w(508) = 0.125792781889592743525E-04;
    w(509) = 0.736624069102321668857E-05;
    w(510) = 0.345456507169149134898E-05;
    w(511) = 0.945715933950007048827E-06;

  else

    fprintf ( 1, '\n' );
    fprintf ( 1, 'GP_SET - Fatal error!\n' );
    fprintf ( 1, '  Illegal input value of N.\n' );
    fprintf ( 1, '  N must be 1, 3, 7, 15, 31, 63, 127, 255 or 511.\n' );
    error ( 'GP_SET - Fatal error!' );

  end

  return
end
function [ x, w ] = hr_compute ( n )

%*****************************************************************************80
%
%% HR_COMPUTE computes a Gauss-Hermite quadrature rule.
%
%  Discussion:
%
%    The abscissas are the zeros of the N-th order Hermite polynomial.
%
%    The integral:
%
%      Integral ( -oo < X < +oo ) exp ( - x * x ) * F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    19 April 2011
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, integer N, the order.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  x = zeros ( n, 1 );
  w = zeros ( n, 1 );

  cc = sqrt ( pi ) * gamma ( n ) / ( 2.0^( n - 1 ) );

  s = ( 2.0 * n + 1.0 )^( 1.0 / 6.0 );

  for i = 1 : floor ( ( n + 1 ) / 2 )

    if ( i == 1 )

      xval = s * s * s - 1.85575 / s;

    elseif ( i == 2 )

      xval = xval - 1.14 * ( ( n )^0.426 ) / xval;

    elseif ( i == 3 )

      xval = 1.86 * xval - 0.86 * x(1);

    elseif ( i == 4 )

      xval = 1.91 * xval - 0.91 * x(2);

    else

      xval = 2.0 * xval - x(i-2);

    end

    [ xval, dp2, p1 ] = hr_root ( xval, n );

    x(i) = xval;
    w(i) = ( cc / dp2 ) / p1;

    x(n-i+1) = - xval;
    w(n-i+1) = w(i);

  end
%
%  Reverse the order.
%
  x(1:n) = x(n:-1:1);

  return
end
function [ p2, dp2, p1 ] = hr_recur ( x, n )

%*****************************************************************************80
%
%% HR_RECUR finds the value and derivative of a Hermite polynomial.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    19 April 2011
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, real X, the point at which polynomials are evaluated.
%
%    Input, integer N, the order of the polynomial to be computed.
%
%    Output, P2, the value of H(N)(X).
%
%    Output, DP2, the value of H'(N)(X).
%
%    Output, P1, the value of H(N-1)(X).
%
  p1 = 1.0;
  dp1 = 0.0;

  p2 = x;
  dp2 = 1.0;

  for i = 2 : n

    p0 = p1;
    dp0 = dp1;

    p1 = p2;
    dp1 = dp2;

    p2  = x * p1 - 0.5 * ( i - 1.0 ) * p0;
    dp2 = x * dp1 + p1 - 0.5 * ( i - 1.0 ) * dp0;

  end

  return
end
function [ x, dp2, p1 ] = hr_root ( x, n )

%*****************************************************************************80
%
%% HR_ROOT improves an approximate root of a Hermite polynomial.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    19 April 2011
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, real X, the approximate root.
%
%    Input, integer N, the order of the Hermite polynomial.
%
%    Output, real X, an improved estimate of the approximate root.
%
%    Output, real DP2, the value of H'(N)(X).
%
%    Output, real P1, the value of H(N-1)(X).
%
  maxstep = 10;

  for i = 1 : maxstep

    [ p2, dp2, p1 ] = hr_recur ( x, n );

    d = p2 / dp2;
    x = x - d;

    if ( abs ( d ) <= eps * ( abs ( x ) + 1.0 ) )
      return
    end

  end

  return
end
function [ x, w ] = jc_compute ( n, alpha, beta )

%*****************************************************************************80
%
%% JC_COMPUTE computes the abscissa and weights for Gauss-Jacobi quadrature.
%
%  Discussion:
%
%    The integral:
%
%      Integral ( -1 <= X <= 1 ) (1-X)**ALPHA * (1+X)**BETA * F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
%
%    Thanks to Xu Xiang of Fudan University for pointing out that
%    an earlier implementation of this routine was incorrect!
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 May 2007
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, integer N, the order.
%
%    Input, real ALPHA, BETA, the exponents of (1-X) and
%    (1+X) in the quadrature rule.  For simple Gauss-Legendre quadrature,
%    set ALPHA = BETA = 0.0.  -1.0 < ALPHA and -1.0 < BETA are required.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%

%
%  Check ALPHA and BETA.
%
  if ( alpha <= -1.0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'JC_COMPUTE - Fatal error!\n' );
    fprintf ( 1, '  -1.0 < ALPHA is required.\n' );
    error ( 'JC_COMPUTE - Fatal error!' );
  end

  if ( beta <= -1.0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'JC_COMPUTE - Fatal error!\n' );
    fprintf ( 1, '  -1.0 < BETA is required.\n' );
    error ( 'JC_COMPUTE - Fatal error!' );
  end

  x = zeros ( n, 1 );
  w = zeros ( n, 1 );
  b = zeros ( n, 1 );
  c = zeros ( n, 1 );
%
%  Set the recursion coefficients.
%
  for i = 1 : n

    if ( alpha + beta == 0.0 || beta - alpha == 0.0 )

      b(i) = 0.0;

    else

      b(i) = ( alpha + beta ) * ( beta - alpha ) / ...
            ( ( alpha + beta + 2 * i ) ...
            * ( alpha + beta + 2 * i - 2 ) );

    end

    if ( i == 1 )

      c(i) = 0.0;

    else

      c(i) = 4.0 * ( i - 1 ) * ( alpha + i - 1 ) * ( beta + i - 1 ) ...
        * ( alpha + beta + i - 1 ) / ( ( alpha + beta + 2 * i - 1 ) ...
        * ( alpha + beta + 2 * i - 2 )^2 * ( alpha + beta + 2 * i - 3 ) );

    end

  end

  delta = exp ( gammaln ( alpha        + 1.0 ) ...
              + gammaln (         beta + 1.0 ) ...
              - gammaln ( alpha + beta + 2.0 ) );

  cc = delta * 2.0^( alpha + beta + 1.0 ) * prod ( c(2:n) );

  for i = 1 : n

    if ( i == 1 )

      an = alpha / n;
      bn = beta / n;

      r1 = ( 1.0 + alpha ) * ( 2.78 / ( 4.0 + n * n ) ...
        + 0.768 * an / n );

      r2 = 1.0 + 1.48 * an + 0.96 * bn + 0.452 * an^2 + 0.83 * an * bn;

      xval = ( r2 - r1 ) / r2;

    elseif ( i == 2 )

      r1 = ( 4.1 + alpha ) / ...
        ( ( 1.0 + alpha ) * ( 1.0 + 0.156 * alpha ) );

      r2 = 1.0 + 0.06 * ( n - 8.0 ) * ( 1.0 + 0.12 * alpha ) / n;

      r3 = 1.0 + 0.012 * beta * ...
        ( 1.0 + 0.25 * abs ( alpha ) ) / n;

      xval = xval - r1 * r2 * r3 * ( 1.0 - xval );

    elseif ( i == 3 )

      r1 = ( 1.67 + 0.28 * alpha ) / ( 1.0 + 0.37 * alpha );

      r2 = 1.0 + 0.22 * ( n - 8.0 ) / n;

      r3 = 1.0 + 8.0 * beta / ( ( 6.28 + beta ) * n * n );

      xval = xval - r1 * r2 * r3 * ( x(1) - xval );

    elseif ( i < n - 1 )

      xval = 3.0 * x(i-1) - 3.0 * x(i-2) + x(i-3);

    elseif ( i == n - 1 )

      r1 = ( 1.0 + 0.235 * beta ) / ( 0.766 + 0.119 * beta );

      r2 = 1.0 / ( 1.0 + 0.639 * ( n - 4.0 ) ...
        / ( 1.0 + 0.71 * ( n - 4.0 ) ) );

      r3 = 1.0 / ( 1.0 + 20.0 * alpha / ( ( 7.5 + alpha ) * n * n ) );

      xval = xval + r1 * r2 * r3 * ( xval - x(i-2) );

    elseif ( i == n )

      r1 = ( 1.0 + 0.37 * beta ) / ( 1.67 + 0.28 * beta );

      r2 = 1.0 / ( 1.0 + 0.22 * ( n - 8.0 ) / n );

      r3 = 1.0 / ( 1.0 + 8.0 * alpha / ( ( 6.28 + alpha ) * n * n ) );

      xval = xval + r1 * r2 * r3 * ( xval - x(i-2) );

    end

    [ xval, dp2, p1 ] = jc_root ( xval, n, alpha, beta, b, c );

    x(i) = xval;
    w(i) = cc / ( dp2 * p1 );

  end
%
%  Reverse the order of the values.
%
  x = r8vec_reverse ( n, x );
  w = r8vec_reverse ( n, w );

  return
end
function [ p2, dp2, p1 ] = jc_recur ( x, n, alpha, beta, b, c )

%*****************************************************************************80
%
%% JC_RECUR finds the value and derivative of a Jacobi polynomial.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    12 October 2005
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, real X, the point at which polynomials are evaluated.
%
%    Input, integer N, the order of the polynomial to be computed.
%
%    Input, real ALPHA, BETA, the exponents of (1-X) and
%    (1+X) in the quadrature rule.
%
%    Input, real B(N), C(N), the recursion coefficients.
%
%    Output, real P2, the value of J(N)(X).
%
%    Output, real DP2, the value of J'(N)(X).
%
%    Output, real P1, the value of J(N-1)(X).
%
  p1 = 1.0;
  dp1 = 0.0;

  p2 = x + ( alpha - beta ) / ( alpha + beta + 2.0 );
  dp2 = 1.0;

  for i = 2 : n

    p0 = p1;
    dp0 = dp1;

    p1 = p2;
    dp1 = dp2;

    p2 = ( x - b(i) ) * p1 - c(i) * p0;
    dp2 = ( x - b(i) ) * dp1 + p1 - c(i) * dp0;

  end

  return
end
function [ x, dp2, p1 ] = jc_root ( x, n, alpha, beta, b, c )

%*****************************************************************************80
%
%% JC_ROOT improves an approximate root of a Jacobi polynomial.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    12 October 2005
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, real X, the approximate root.
%
%    Input, integer N, the order of the polynomial to be computed.
%
%    Input, real ALPHA, BETA, the exponents of (1-X) and
%    (1+X) in the quadrature rule.
%
%    Input, real B(N), C(N), the recursion coefficients.
%
%    Output, real X, the improved approximate root.
%
%    Output, real DP2, the value of J'(N)(X).
%
%    Output, real P1, the value of J(N-1)(X).
%
  maxstep = 10;

  for i = 1 : maxstep

    [ p2, dp2, p1 ] = jc_recur ( x, n, alpha, beta, b, c );

    d = p2 / dp2;
    x = x - d;

    if ( abs ( d ) <= eps * ( abs ( x ) + 1.0 ) )
      return
    end

  end

  return
end
function [ x, w ] = lg_compute ( n )

%*****************************************************************************80
%
%% LG_COMPUTE computes a Gauss-Laguerre quadrature rule.
%
%  Discussion:
%
%    The integral:
%
%      Integral ( 0 <= X < +oo ) EXP ( - X ) * F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * F ( X(I) )
%
%    The integral:
%
%      Integral ( 0 <= X < +oo ) F(X) dX
%
%    The quadrature rule:
%
%      Sum ( 1 <= I <= N ) W(I) * EXP ( X(I) ) * F ( X(I) )
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    20 February 2008
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, integer N, the order.
%    N must be at least 1.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  x = zeros ( n, 1 );
  w = zeros ( n, 1 );
%
%  Set the recursion coefficients.
%
  b = zeros ( n );
  for i = 1 : n
    b(i) = 2 * i - 1;
  end

  c = zeros ( n );
  for i = 1 : n
    c(i) = ( i - 1 ) * ( i - 1 );
  end

  cc = prod ( c(2:n) );

  for i = 1 : n
%
%  Compute an estimate for the root.
%
    if ( i == 1 )

      xval = 3.0 / ( 1.0 + 2.4 * n );

    elseif ( i == 2 )

      xval = xval + 15.0 / ( 1.0 + 2.5 * n );

    else

      r1 = ( 1.0 + 2.55 * ( i - 2 ) ) / ( 1.9 * ( i - 2 ) );

      xval = xval + r1 * ( xval - x(i-2) );

    end
%
%  Use iteration to find the root.
%
    [ xval, dp2, p1 ] = lg_root ( xval, n, b, c );
%
%  Set the abscissa and weight.
%
    x(i) = xval;
    w(i) = ( cc / dp2 ) / p1;

  end

  return
end
function [ p2, dp2, p1 ] = lg_recur ( x, n, b, c )

%*****************************************************************************80
%
%% LG_RECUR finds the value and derivative of a Laguerre polynomial.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    20 February 2008
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, real X, the point at which polynomials are evaluated.
%
%    Input, integer N, the order of the polynomial.
%
%    Input, real B(N), C(N), the recursion coefficients.
%
%    Output, real P2, the value of L(N)(X).
%
%    Output, real DP2, the value of L'(N)(X).
%
%    Output, real P1, the value of L(N-1)(X).
%
  p1 = 1.0;
  dp1 = 0.0;

  p2 = x - 1.0;
  dp2 = 1.0;

  for i = 2 : n

    p0 = p1;
    dp0 = dp1;

    p1 = p2;
    dp1 = dp2;

    p2 = ( x - b(i) ) * p1 - c(i) * p0;
    dp2 = ( x - b(i) ) * dp1 + p1 - c(i) * dp0;

  end

  return
end
function [ x, dp2, p1 ] = lg_root ( x, n, b, c )

%*****************************************************************************80
%
%% LG_ROOT improves an approximate root of a Laguerre polynomial.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    20 February 2008
%
%  Author:
%
%    Original FORTRAN77 version by Arthur Stroud, Don Secrest.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Arthur Stroud, Don Secrest,
%    Gaussian Quadrature Formulas,
%    Prentice Hall, 1966,
%    LC: QA299.4G3S7.
%
%  Parameters:
%
%    Input, real X, the approximate root, which
%    should be improved on output.
%
%    Input, integer N, the order of the polynomial.
%
%    Input, real B(N), C(N), the recursion coefficients.
%
%    Output, real X, the approximate root, which
%    should be improved on output.
%
%    Output, real DP2, the value of L'(N)(X).
%
%    Output, real P1, the value of L(N-1)(X).
%
  maxstep = 10;

  for i = 1 : maxstep

    [ p2, dp2, p1 ] = lg_recur ( x, n, b, c );

    d = p2 / dp2;
    x = x - d;

    if ( abs ( d ) <= eps * ( abs ( x ) + 1.0 ) )
      return;
    end

  end

  return
end
function x = ncc_compute ( n )

%*****************************************************************************80
%
%% NCC_COMPUTE sets abscissas for a closed Newton-Cotes grid.
%
%  Discussion:
%
%    The closed Newton-Cotes rules use equally spaced abscissas, and
%    hence may be used with tabulated function data.
%
%    The rules are called "closed" because they include the endpoints.
%    As a favor, we include an order 1 rule, the midpoint rule, even
%    though this does not satisfy the requirement that the endpoints
%    be included.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    20 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.
%
%    Johnson,
%    Quarterly Journal of Mathematics,
%    Volume 46, Number 52, 1915.
%
%    Zdenek Kopal,
%    Numerical Analysis,
%    John Wiley, 1955,
%    LC: QA297.K6.
%
%    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.
%
%    Output, real X(N), the abscissas.
%
  if ( n == 1 )
    x = 0.0;
  else
    x = ( ( 1 - n ) : 2 : ( n - 1 ) ) / ( n - 1 );
  end

  x = x(:);

  return
end
function x = nco_compute ( n )

%*****************************************************************************80
%
%% NCO_COMPUTE sets abscissas for an open Newton-Cotes quadrature.
%
%  Discussion:
%
%    The open Newton-Cotes rules use equally spaced abscissas, and
%    hence may be used with equally spaced data.
%
%    The rules are called "open" because they do not include the interval
%    endpoints.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    02 May 2006
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Abramowitz and Stegun,
%    Handbook of Mathematical Functions,
%    National Bureau of Standards, 1964.
%
%    Stephen Wolfram,
%    The Mathematica Book,
%    Fourth Edition,
%    Wolfram Media / Cambridge University Press, 1999.
%
%    Daniel Zwillinger, editor,
%    Standard Mathematical Tables and Formulae,
%    30th Edition,
%    CRC Press, 1996.
%
%  Parameters:
%
%    Input, integer N, the order.
%
%    Output, real X(N), the abscissas.
%

%
%  Set the abscissas.
%
  x = ( ( 1 - n ) : 2 : ( n - 1 ) ) / ( n + 1 );

  x = x(:);

  return
end
function x = ncoh_compute ( n )

%*****************************************************************************80
%
%% NCOH_COMPUTE sets abscissas for a Newton-Cotes "open half" quadrature.
%
%  Discussion:
%
%    The Newton-Cotes rules use equally spaced abscissas, and
%    hence may be used with equally spaced data.
%
%    The rules are called "open" because the abscissas do not include
%    the interval endpoints.
%
%    For this uncommon type of open Newton-Cotes rule, the abscissas for
%    rule N are found by dividing the interval into N equal subintervals,
%    and using the midpoint of each subinterval as the abscissa.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    21 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.
%
%    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.
%    1 <= N <= 17.
%
%    Output, real X(N), the abscissas.
%
%    Output, real W(N), the weights.
%
  if ( n == 1 )
    x = 0.0;
  else
    x = ( ( - n + 1 ) : 2 : ( n - 1 ) ) / n;
  end

  x = x(:);

  return
end
function x = rule_compute ( n, rule )

%*****************************************************************************80
%
%% RULE_COMPUTE computes the abscissas of a rule.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    11 October 2011
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the order of the rule.
%
%    Input, string RULE, a code for the rule:
%    'CC', Clenshaw-Curtis,
%    'F1', Fejer Type 1,
%    'F2', Fejer Type 2,
%    'GL', Gauss-Legendre,
%    'GP', Gauss-Patterson,
%    'HR', Hermite,
%    'JC', Jacobi,
%    'LG', Laguerre,
%    'NCC', Newton-Cotes Closed,
%    'NCO', Newton-Cotes Open,
%    'NCOH', Newton-Cotes Open Half.
%
  rule = lower ( rule );

  if ( strcmp ( rule, 'cc' ) )
    x = cc_compute ( n );
  elseif ( strcmp ( rule, 'f1' ) )
    x = f1_compute ( n );
  elseif ( strcmp ( rule, 'f2' ) )
    x = f2_compute ( n );
  elseif ( strcmp ( rule, 'gl' ) )
    x = gl_compute ( n );
  elseif ( strcmp ( rule, 'gp' ) )
    x = gp_set ( n );
  elseif ( strcmp ( rule, 'hr' ) )
    x = hr_compute ( n );
  elseif ( strcmp ( rule, 'jc' ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Jacobi rule requires exponents ALPHA and BETA!\n' );
    alpha = input ( '  Enter ALPHA:  ' );
    beta = input ( '  Enter BETA:  ' );
    x = jc_compute ( n, alpha, beta );
  elseif ( strcmp ( rule, 'lg' ) )
    x = lg_compute ( n );
  elseif ( strcmp ( rule, 'ncc' ) )
    x = ncc_compute ( n );
  elseif ( strcmp ( rule, 'nco' ) )
    x = nco_compute ( n );
  elseif ( strcmp ( rule, 'ncoh' ) )
    x = ncoh_compute ( n );
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, 'RULE_COMPUTE - Fatal error!\n' );
    fprintf ( 1, '  Unrecognized rule.\n' );
    error ( 'RULE_COMPUTE - Fatal error!' )
  end

  return
end
function [ m, n_1d, rule ] = tensor_grid_define ( m, n_1d, rule )

%*****************************************************************************80
%
%% TENSOR_GRID_DEFINE has the user define a tensor product grid.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    12 October 2011
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Output, integer M, the spatial dimension.
%
%    Output, integer N_1D(M), the order of the 1D rules.
%
%    Output, string RULE, a code for the rule:
%    'CC', Clenshaw-Curtis,
%    'F1', Fejer Type 1,
%    'F2', Fejer Type 2,
%    'GL', Gauss-Legendre,
%    'GP', Gauss-Patterson,
%    'HR', Hermite,
%    'JC', Jacobi,
%    'LG', Laguerre,
%    'NCC', Newton-Cotes Closed,
%    'NCO', Newton-Cotes Open,
%    'NCOH', Newton-Cotes Open Half.
%
  if ( nargin < 3 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'TENSOR_DEFINE:\n' );
    fprintf ( 1, '  Enter information needed to define a tensor grid.\n' );
  end

  if ( nargin < 1 )
    m = input ( 'Enter M, the spatial dimension:  ' );
  end

  if ( nargin < 2 )
    n_1d = zeros ( m, 1 );
    for i = 1 : m
      n_1d(i) = input ( sprintf ( 'Enter the order of the rule in dimension %d:  ', i ) );
    end
  end

  if ( nargin < 3 )
    rule = input ( 'Enter the rule code: ''CC''/''F1''/''F2''/''GL''/''GP''/''HR''/''JC''/''LG''/''NCC''/''NCO''/''NCOH'':  ' );
  end

  return
end
function grid_x = tensor_product ( dim_num, order, rule )

%*****************************************************************************80
%
%% TENSOR_PRODUCT computes the points of a tensor product grid.
%
%  Discussion:
%
%    If the coordinates of each factor rule are given in lexicographic order,
%    then the DIM_NUM-dimensional points produced by this function will
%    also be in lexicographic order.
%
%  Example:
%
%    DIM_NUM = 3
%    ORDER = [ 2, 3, 2 ]
%    RULE = { [1], [2,3], [4,5,6], ... } (just for clarity)
%
%    GRID_NUM = 12
%    GRID_X =
%      2  2  2  2  2  2  3  3  3  3  3  3
%      4  4  5  5  6  6  4  4  5  5  6  6
%      2  3  2  3  2  3  2  3  2  3  2  3
%
%    Read the columns of GRID_X to see the 12 vectors created.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    09 October 2011
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer DIM_NUM, the spatial dimension.
%
%    Input, integer ORDER(DIM_NUM), the order of the rule in each dimension.
%
%    Input, integer RULE, the index of the rule used in all dimensions.
%
%    Output, real GRID_X(DIM_NUM,GRID_NUM), the points of the grid.
%
  grid_num = prod ( order(1:dim_num) );

  grid_x = zeros ( dim_num, grid_num );

  chunk_num = 1;
  rep_num = grid_num;

  for dim = 1 : dim_num

    x = rule_compute ( order(dim), rule );
    x = x ( : );

    chunk_num = chunk_num * order(dim);
    rep_num = rep_num / order(dim);

    i = 1;
    j = 1;
    for chunks = 1 : chunk_num
      for reps = 1 : rep_num
        grid_x(dim,j) = x(i);
        j = j + 1;
      end
      i = i + 1;
      if ( order(dim) < i )
        i = 1;
      end
    end

  end

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% TIMESTAMP prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end
