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

%*****************************************************************************80
%
%% minimal_surface_catenoid_exact() evaluates catenoid 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 helicoid solution is:
%      U(X,Y) = acosh ( a sqrt(X^2+Y^2) ) / a
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 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 = acosh ( a * sqrt ( X.^2 + Y.^2 ) ) / a;
  Ux = X ./ ( sqrt ( X.^2 + Y.^2 ) .* sqrt ( a^2 * ( X.^2 + Y.^2 ) - 1 ) );
  Uy = Y ./ ( sqrt ( X.^2 + Y.^2 ) .* sqrt ( a^2 * ( X.^2 + Y.^2 ) - 1 ) );
  Uxx = - ( a^2 * X.^2 ./ ( a^2 * ( X.^2 + Y.^2 ) - 1 ) ...
    + X.^2 ./ ( X.^2 + Y.^2 ) - 1 ) ./ ( sqrt ( X.^2 + Y.^2 ) ...
    .* sqrt ( a^2 .* ( X.^2 + Y.^2 ) - 1 ) );
  Uxy = - X .* Y .* ( a^2 ./ ( a^2 * ( X.^2 + Y.^2 ) - 1 ) ...
    + 1 ./ ( X.^2 + Y.^2 ) ) ./ ( sqrt ( X.^2 + Y.^2 ) ...
    .* sqrt ( a^2 * ( X.^2 + Y.^2 ) - 1 ) );
  Uyy = - ( a^2 * Y.^2 ./ ( a^2 * ( X.^2 + Y.^2 ) - 1 ) ...
    + Y.^2 ./ ( X.^2 + Y.^2 ) - 1 ) ./ ( sqrt ( X.^2 + Y.^2 ) ...
    .* sqrt ( a^2 * ( X.^2 + Y.^2 ) - 1 ) );

  return
end
