function nonlin_fixed_point_test ( )

%*****************************************************************************80
%
%% nonlin_fixed_point_test() tests nonlin_fixed_point().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 July 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../nonlin_fixed_point' );

  timestamp ( );
  fprintf ( 1, 'nonlin_fixed_point_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  nonlin_fixed_point() is an interactive program to seek\n' );
  fprintf ( 1, '  a root of an equation using the fixed point method.\n' );

  x0 = 1.0;
  it = 10;
  [ x, fx ] = nonlin_fixed_point ( 'x^2-5', '(x+5/x)/2', x0, it );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  i    x(i)    f(x(i))\n' );
  for i = 0 : it
    fprintf ( 1, '  %d  %f  %f\n', i, x(i+1), fx(i+1) );
  end

  it = 10;
  x0 = 1.0;
  [ x, fx ] = nonlin_fixed_point ( 'x-1-0.3*sin(x)', '1.0+0.3*sin(x)', x0, it );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  i    x(i)    f(x(i))\n' );
  for i = 0 : it
    fprintf ( 1, '  %d  %f  %f\n', i, x(i+1), fx(i+1) );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'nonlin_fixed_point_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../nonlin_fixed_point' );

  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

