function contour_gradient_3d_test ( )

%*****************************************************************************80
%
%% contour_gradient_3d_test() tests contour_gradient_3d().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 January 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../contour_gradient_3d' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'contour_gradient_3d_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s.\n', version ( ) );
  fprintf ( 1, '  Test contour_gradient_3d()\n' );

  xmin = - 3.0;
  xmax = + 3.0;
  nx = 20;

  ymin = -3.0;
  ymax = +3.0;
  ny = 20;

  contour_gradient_3d ( xmin, xmax, nx, ymin, ymax, ny, @f );

  filename = 'contour_gradient_3d_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'contour_gradient_3d_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../contour_gradient_3d' );

  return
end
function Z = f ( X, Y )

%*****************************************************************************80
%
%% Z() evaluates a function of X and Y.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    12 July 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X, Y: the arguments.
%
%  Output:
%
%    real Z: the function value.
%
  Z = 0.5 * ( 3 * X.^2 + 4 * X .* Y + 6 * Y.^2 ) - 2 * X + 8 * Y + 50;

  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

