function simplex_gm_rule_test10 ( )

%*****************************************************************************80
%
%% simplex_gm_rule_test10() tests gm_general_rule_set().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 March 2017
%
%  Author:
%
%    John Burkardt
%
  m = 3;

  e_test = [ ...
    0, 0, 0; ...
    1, 0, 0; ...
    0, 1, 0; ...
    0, 0, 1; ...
    2, 0, 0; ...
    1, 1, 0; ...
    1, 0, 1; ...
    0, 2, 0; ...
    0, 1, 1; ...
    0, 0, 2 ]';

  t = [ ...
    1.0, 0.0, 0.0; ...
    2.0, 0.0, 0.0; ...
    1.0, 2.0, 0.0; ...
    1.0, 0.0, 3.0 ]';

  fprintf ( 1, '\n' );
  fprintf ( 1, 'simplex_gm_rule_test10():\n' );
  fprintf ( 1, '  gm_general_rule_set() determines the weights and abscissas\n' );
  fprintf ( 1, '  of a Grundmann-Moeller quadrature rule for\n' );
  fprintf ( 1, '  the M dimensional general simplex,\n' );
  fprintf ( 1, '  using a rule of index RULE,\n' );
  fprintf ( 1, '  which will have degree of exactness 2*RULE+1.\n' );

  fprintf ( 1, '  In this test, look at all the monomials up to\n' );
  fprintf ( 1, '  some maximum degree, choose a few low order rules\n' );
  fprintf ( 1, '  and determine the quadrature error for each.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Simplex vertices:\n' );
  fprintf ( 1, '\n' );
  for j = 1 : 4
    for i = 1 : 3
      fprintf ( 1, '%14.6g', t(i,j) );
    end
    fprintf ( 1, '\n' );
  end

  volume = simplex_general_volume ( m, t );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Simplex volume = %g\n', volume );

  fprintf ( 1, '\n' );
  fprintf ( 1, '         N        1               X               Y ' );
  fprintf ( 1,'              Z               X^2              XY             XZ' );
  fprintf ( 1, '              Y^2             YZ               Z^2\n' );
  fprintf ( 1, '\n' );

  for rule = 0 : 5

    n = gm_rule_size ( rule, m );

    [ w, x ] = gm_general_rule_set ( rule, m, n, t );

    fprintf ( 1, '  %8d', n );

    for k = 1 : 10

      e(1:m) = e_test(1:m,k);

      value = monomial_value ( m, n, e, x  );

      result = w' * value;

      fprintf ( 1, '  %14.6g', result );
    end

    fprintf ( 1, '\n' );

  end

  return
end
