function dirichlet_test ( )

%*****************************************************************************80
%
%% dirichlet_test() tests dirichlet().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 July 2025
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../dirichlet' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'dirichlet_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test dirichlet().\n' );
%
%  Plots.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Plot f(x,n) for several values of n\n' );
  fprintf ( 1, '\n' );
  for n = [ 2, 3, 4, 5, 10, 15, 20, 25 ]
    x = linspace ( -10.0, 10.0, 501 );
    fx = dirichlet ( x, n );
    clf ( );
    plot ( x, fx, 'linewidth', 2 );
    s = sprintf ( 'dirichlet f(x,%d)', n );
    title ( s );
    grid ( 'on' );
    filename = sprintf ( 'dirichlet_%02d.png', n );
    print ( '-dpng', filename );
    fprintf ( 1, '  Graphics saved as "%s"\n', filename );
    close ( );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'dirichlet_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../dirichlet' );

  return
end
function timestamp ( )

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

  return
end
