function mad_stats ( nstep, n_rejected, t )

%*****************************************************************************80
%
%% mad_stats() reports statistics for mad_compute().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 July 2024
%
%  Author:
%
%    John Burkardt, Catalin Trenchea
%
%  Input:
%
%    integer nstep: the number of timesteps.
%
%    integer n_rejected: the number of rejected timesteps.
%
%    real t(nstep+1): the sequence of time values.
%
  tau = t(2:nstep) - t(1:nstep-1);

  fprintf ( 1, '\n' );
  fprintf ( 1, 'mad_stats():\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of timesteps = %d\n', nstep );
  fprintf ( 1, '  Rejected time steps = %d\n', n_rejected );
  fprintf ( 1, '  First time interval is [%g,%g]\n', t(1), t(2) );
  fprintf ( 1, '  Final time interval is [%g,%g]\n', t(nstep-1), t(nstep) );
  fprintf ( 1, '  Minimum timestep is %g\n', min ( tau ) );
  fprintf ( 1, '  Maximum timestep is %g\n', max ( tau ) );

  return
end

