function [ U, Ux, Uy, Uxx, Uxy, Uyy ] = ...
  minimal_surface_scherk_exact ( X, Y, a )

%*****************************************************************************80
%
%% minimal_surface_scherk_exact() evaluates Scherk minimal surface solution U(X,Y).
%
%  Discussion:
%
%    The minimal surface equation describes a function with zero mean curvature.
%
%    The equation is:
%      (1+Ux^2) Uyy - 2 Ux Uy Uxy + (1+Uy^2) Uxx = 0
%
%    The Scherk solution is:
%      U(X,Y) = log ( cos ( a Y ) / cos ( a X ) ) / a
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 May 2025
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John D Cook,
%    Closed-form minimal surface solutions,
%    https://www.johndcook.com/blog/2025/03/31/minimal-surface-solutions/
%    Posted 31 March 2025.
%
%  Input:
%
%    real X, Y: the coordinates of the points.
%
%    real a: a shape parameter.
%
%  Output:
%
%    real U, Ux, Uy, Uxx, Uxy, Uyy: the solution and first and second
%    partial derivatives evaluated at the points (X,Y).
%
  U = log ( cos ( a * Y ) ./ cos ( a * X ) ) / a;
  Ux =  sin ( a * X ) ./ cos ( a * X );
  Uy =  - sin ( a * Y ) ./ cos ( a * Y );
  Uxx =  a * ( sin ( a * X ).^2 ./ cos ( a * X ).^2 + 1 );
  Uxy =  0;
  Uyy =  - a * ( sin ( a * Y ).^2 ./ cos ( a * Y ).^2 + 1 );

  return
end
