function [ UX, UY ] = biharmonic_fd2d_derivative ( X, Y )

%*****************************************************************************80
%
%% biharmonic_fd2d_derivative() evaluates the derivatives of a biharmonic solution.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 June 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X(*), Y(*): evaluation points.
%
%  Output:
%
%    real UX(*), UY(*): the first derivatives.
%
  [ k, xmin, xmax, ymin, ymax ] = biharmonic_fd2d_parameters ( );

  if ( k == 1 )
    UX = ( 1.0 - 2.0 * X ) .* Y .* ( 1.0 - Y );
    UY = X .* ( 1.0 - X ) .* ( 1.0 - 2.0 * Y );
  elseif ( k == 2 )
    UX = 2.0 * X + ( X + 1.0 ) .* exp ( X ) .* cos ( Y );
    UY = - 2.0 * Y.^2  - X .* exp ( X ) .* sin ( Y );
  elseif ( k == 3 )
    UX = 2350.0 * 4.0 * X.^3 .* ( X - 1.0 ).^2 .* Y.^4 .* ( Y - 1.0 ).^2 ...
       + 2350.0 * X.^4 .* 2.0 * ( X - 1.0 ) .* Y.^4 .* ( Y - 1.0 ).^2;
    UY = 2350.0 * X.^4 .* ( X - 1.0 ).^2 .* 3.0 .* Y.^3 .* ( Y - 1.0 ).^2 ...
       + 2350.0 * X.^4 .* ( X - 1.0 ).^2 .* Y.^4 .* 2.0 .* ( Y - 1.0 );
  elseif ( k == 4 )
    UX = pi * cos ( pi * X ) .* sin ( pi * Y );
    UY = pi * sin ( pi * X ) .* cos ( pi * Y );
  end

  return
end

