function logistic_exact_test ( )

%*****************************************************************************80
%
%% logistic_exact_test() tests logistic_exact().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 May 2024
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../logistic_exact' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'logistic_exact_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  logistic_exact() evaluates the exact solution of the logistic ODE.\n' );
%
%  Get parameters.
%
  [ r, k, t0, y0, tstop ] = logistic_parameters ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  parameters:\n' );
  fprintf ( 1, '    r     = %g\n', r );
  fprintf ( 1, '    k     = %g\n', k );
  fprintf ( 1, '    t0    = %g\n', t0 );
  fprintf ( 1, '    y0    = %g\n', y0 );
  fprintf ( 1, '    tstop = %g\n', tstop );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Evaluate exact solution for varied values of y0:\n' );

  t = linspace ( t0, tstop, 101 );

  clf ( );
  hold ( 'on' );

  for y0 = [ 0.05, 0.1, 0.2, 0.5 ]

    fprintf ( 1, '    y0    = %g\n', y0 );
    logistic_parameters ( r, k, t0, y0, tstop );
    y = logistic_exact ( t );
    plot ( t, y, 'linewidth', 3 );

  end

  hold ( 'off' );

  title ( 'logistic\_exact(), vary initial condition' );
  legend ( '0.05', '0.1', '0.2', '0.5' )
  grid ( 'on' );
  xlabel ( '<--- T --->' );
  ylabel ( '<--- Y(T) --->' );
  filename = 'logistic_exact.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'logistic_exact_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../logistic_exact' )

  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

