function contour_gradient_test01 ( )

%*****************************************************************************80
%
%% contour_gradient_test01() seeks a contour and gradient plot for a specific function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 December 2018
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real XMIN, XMAX, YMIN, YMAX, define the plotting rectangle.
%
%    function Z = F ( X, Y ), a handle to the function.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'CONTOUR_GRADIENT_TEST01\n' );
  fprintf ( 1, '  Draw a combined contour and gradient plot for the function\n' );
  fprintf ( 1, '    f(x,y) = 0.5 * ( 3 * x.^2 + 4 * x .* y + 6 * y.^2 ) - 2 * x + 8 * y\n' );
  fprintf ( 1, '  over the range [-3,3]x[-3,3].\n' );

  xmin = - 3.0;
  xmax = + 3.0;

  ymin = -3.0;
  ymax = +3.0;

  contour_gradient ( xmin, xmax, ymin, ymax, @f );

  filename = 'contour_gradient_test01.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end
function z = f ( x, y )

%*****************************************************************************80
%
%% f() evaluates the function whose contours we are seeking.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 November 2013
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X, Y, the evaluation point.
%
%  Output:
%
%    real Z, the function value.
%
  z = 0.5 * ( 3 * x.^2 + 4 * x .* y + 6 * y.^2 ) - 2 * x + 8 * y;

  return
end

