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

%*****************************************************************************80
%
%% minimal_surface_helicoid_exact() evaluates helicoid 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) = arctan ( X / Y )
%
%  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.
%
%  Output:
%
%    real U, Ux, Uy, Uxx, Uxy, Uyy: the solution and first and second
%    partial derivatives evaluated at the points (X,Y).
%
  U = atan ( X ./ Y );
  Ux = 1 ./ ( Y .* ( X.^2 ./ Y.^2 + 1 ) );
  Uy = - X ./ ( Y.^2 .* ( X.^2 ./ Y.^2 + 1 ) );
  Uxx = - 2 * X ./ ( Y.^3 .* ( X.^2 ./ Y.^2 + 1 ).^2 );
  Uxy = ( 2 * X.^2 ./ ( Y.^2 .* ( X.^2 ./ Y.^2 + 1 ) ) - 1 ) ...
    ./ ( Y.^2 .* ( X.^2 ./ Y.^2 + 1 ) );
  Uyy = 2 * X .* ( - X.^2 ./ ( Y.^2 .* ( X.^2 ./ Y.^2 + 1 ) ) + 1 ) ...
    ./ ( Y.^3 .* ( X.^2 ./ Y.^2 + 1 ) );

  return
end
