function change_polynomial_test ( )

%*****************************************************************************80
%
%% change_polynomial_test() tests change_polynomial().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    23 October 2022
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../change_polynomial' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'change_polynomial_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s.\n', version ( ) );
  fprintf ( 1, '  change_polynomial() uses a polynomial algorithm to count\n' );
  fprintf ( 1, '  the number of ways of using a given number of coins to make a sum.\n' );

  value = [ 1, 5, 10, 25 ];
  target = 75;
  coin_num = 3;

  a1 = change_polynomial ( value, target, coin_num );
%
%  Adding a coin of value 0 allows us to count ways of using 0 through coin_num coins.
%
  value = [ 0, 1, 5, 10, 25 ];
  target = 75;
  coin_num = 3;

  a2 = change_polynomial ( value, target, coin_num );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Sum  3 coins  0/1/2/3 coins\n' );
  fprintf ( 1, '\n' );
  for i = 0 : target
    fprintf ( 1, '  %2d     %2d     %2d\n', i, a1(i+1), a2(i+1) )
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'change_polynomial_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../change_polynomial' );

  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 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

