function triangle_witherden_rule_test01 ( p )

%*****************************************************************************80
%
%% triangle_witherden_rule_test01() computes a quadrature rule of given order.
%
%  Licensing:
%
%    This code is distributed under the GNU GPL license.
%
%  Modified:
%
%    27 May 2023
%
%  Author:
%
%    John Burkardt.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'triangle_witherden_rule_test01():\n' );
  fprintf ( 1, '  Quadrature rule for the triangle,\n' );
  fprintf ( 1, '  given in barycentric coordinates.\n' );
  fprintf ( 1, '  Precision p = %d\n', p );
%
%  Retrieve the rule.
%
  [ n, a, b, c, w ] = triangle_witherden_rule ( p );
%
%  Print the rule.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '     I      W          A           B           C\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %4d  %10.6g  %10.6g  %10.6g  %10.6g\n', ...
      i, w(i), a(i), b(i), c(i) );
  end
%
%  Verify weights sum to 1.
%
  w_sum = sum ( w(1:n) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Weight Sum    %g\n', w_sum );

  return
end
