function fisher_exact_test ( )

%*****************************************************************************80
%
%% fisher_exact_test() tests fisher_exact().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 May 2024
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../fisher_exact' );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'fisher_exact_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Test fisher_exact(), for exact solutions of Fisher PDE.\n' );
%
%  Report the current parameter values.
%
  [ a, c, k ] = fisher_parameters ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  parameters:\n' );
  fprintf ( 1, '    a = %g\n', a );
  fprintf ( 1, '    c = %g\n', c );
  fprintf ( 1, '    k = %g\n', k );

  f_residual_test ( );

  fisher_residual_test ( );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'fisher_exact_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  timestamp ( );

  rmpath ( '../fisher_exact' );

  return
end
function f_residual_test ( )

%*****************************************************************************80
%
%% f_residual_test() tests f_residual().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 May 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'f_residual_test():\n' );
  fprintf ( 1, '  Evaluate F(Z) and residual at selected points Z=X-cT\n' );

  x = linspace ( 0.0, 1.0, 6 );
  t = linspace ( 0.0, 10.0, 6 );

  [ a, c, k ] = fisher_parameters ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '      Z       F(Z)      Resid(Z)\n' );
  fprintf ( 1, '\n' );
  for j = 1 : 6
    for i = 1 : 6
      z = x(i) - c * t(j);
      [ f, fz, fzz ] = f_exact ( z );
      r = f_residual ( f, fz, fzz );
      fprintf ( 1, '  %f  %f  %g\n', z, f, r );
    end
    fprintf ( 1, '\n' );
  end
  return
end
function fisher_residual_test ( )

%*****************************************************************************80
%
%% fisher_residual_test() tests fisher_residual().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 May 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'fisher_residual_test():\n' );
  fprintf ( 1, '  Evaluate solution and residual at selected points (X,T)\n' );
  
  x = linspace ( 0.0, 1.0, 6 );
  t = linspace ( 0.0, 10.0, 6 );

  fprintf ( 1, '\n' );
  fprintf ( 1, '      X       T       U(X,T)      Resid(X,T)\n' );
  fprintf ( 1, '\n' );
  for j = 1 : 6
    for i = 1 : 6
      [ u, ut, ux, uxx ] = fisher_exact ( x(i), t(j) );
      r = fisher_residual ( x(i), t(j) );
      fprintf ( 1, '  %f  %f  %f  %g\n', x(i), t(j), u, r );
    end
    fprintf ( 1, '\n' );
  end

  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

