function wm_test ( )

%*****************************************************************************80
%
%% wm_test() calls wm_tester() with various parameter values.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 November 2015
%
%  Author:
%
%    John Burkardt.
%
  m = 5;
  kind = 1;
  alpha = 0.0;
  beta = 0.0;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 2;
  alpha = 0.0;
  beta = 0.0;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 3;
  alpha = 0.5;
  beta = 0.0;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 4;
  alpha = 0.25;
  beta = 0.75;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 5;
  alpha = 2.0;
  beta = 0.0;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 6;
  alpha = 1.0;
  beta = 0.0;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 7;
  alpha = 2.0;
  beta = 0.0;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 8;
  alpha = -0.5;
  beta = -6.0;
  wm_tester ( m, kind, alpha, beta );

  m = 5;
  kind = 9;
  alpha = 0.0;
  beta = 0.0;
  wm_tester ( m, kind, alpha, beta );

  return
end
function wm_tester ( m, kind, alpha, beta )

%*****************************************************************************80
%
%% wm_tester() tests wm().
%
%  Discussion:
%
%    Moment(K) = Integral ( A <= X <= B ) X^(K-1) * W(X) dx
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 November 2015
%
%  Author:
%
%    John Burkardt.
%
%  Reference:
%
%    Sylvan Elhay, Jaroslav Kautsky,
%    Algorithm 655: IQPACK, FORTRAN Subroutines for the Weights of
%    Interpolatory Quadrature,
%    ACM Transactions on Mathematical Software,
%    Volume 13, Number 4, December 1987, pages 399-415.
%
%  Input:
%
%    integer M, the number of moments to evaluate.
%
%    integer KIND, the rule.
%    1, Legendre,             (a,b)       1.0
%    2, Chebyshev Type 1,     (a,b)       ((b-x)*(x-a))^(-0.5)
%    3, Gegenbauer,           (a,b)       ((b-x)*(x-a))^alpha
%    4, Jacobi,               (a,b)       (b-x)^alpha*(x-a)^beta
%    5, Generalized Laguerre, (a,+oo)     (x-a)^alpha*exp(-b*(x-a))
%    6, Generalized Hermite,  (-oo,+oo)   |x-a|^alpha*exp(-b*(x-a)^2)
%    7, Exponential,          (a,b)       |x-(a+b)/2.0|^alpha
%    8, Rational,             (a,+oo)     (x-a)^alpha*(x+b)^beta
%    9, Chebyshev Type 2,     (a,b)       ((b-x)*(x-a))^(+0.5)
%
%    real ALPHA, the value of Alpha, if needed.
%
%    real BETA, the value of Beta, if needed.
%
  w = wm ( m, kind, alpha, beta );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'wm_tester():\n' );
  fprintf ( 1, '  wm_test() computes moments for rule %d\n', kind )
  fprintf ( 1, '  with ALPHA = %g, BETA = %g\n', alpha, beta );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Order          Moment\n' );
  fprintf ( 1, '\n' );
  for i = 1 : m
    fprintf ( 1, '     %2d  %14.6g\n', i - 1, w(i) );
  end
  return
end
