function R = biharmonic_exact_r1 ( X, Y, a, b, c, d, e, f, g )

%*****************************************************************************80
%
%% biharmonic_exact_r1() evaluates exact biharmonic residual for W(X,Y) #1.
%
%  Discussion:
%
%   Note the formula for W:
%
%   W = ( a      * cosh ( g * X ) ...
%      + b      * sinh ( g * X ) ...
%      + c * X .* cosh ( g * X ) ...
%      + d * X .* sinh ( g * X ) ) ... 
%      .* ...
%      ( e * cos ( g * Y ) ...
%      + f * sin ( g * Y ) );
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 August 2024
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X, Y: the coordinates of the points.
%
%    real a, b, c, d, e, f, g: parameters.
%
%  Output:
%
%    real R: the residual evaluated at the points (X,Y).
%
  Wxxxx =  ...
    g^3 * ( e * cos ( g * Y ) + f * sin ( g * Y ) ) ...
    .* ...
    (     a * g      * cosh ( g * X ) ...
    +     b * g      * sinh ( g * X ) ...
    +     c * g * X .* cosh ( g * X ) ...
    + 4 * c          * sinh ( g * X ) ...
    +     d * g * X .* sinh ( g * X ) ...
    + 4 * d          * cosh ( g * X ) );

  Wxxyy = ...
    -g^3 * ( e * cos ( g * Y ) + f * sin ( g * Y ) ) ...
    .* ...
    (     a * g      * cosh ( g * X ) ...
    +     b * g      * sinh ( g * X ) ... 
    +     c * g * X .* cosh ( g * X ) ... 
    + 2 * c          * sinh ( g * X )  ...
    +     d * g * X .* sinh ( g * X ) ... 
    + 2 * d          * cosh ( g * X ) );


  Wyyyy = ...
    g^4 * ( e * cos ( g * Y ) + f * sin ( g * Y ) ) ...
    .* ...
    ( a      * cosh ( g * X ) ...
    + b      * sinh ( g * X ) ...
    + c * X .* cosh ( g * X ) ...
    + d * X .* sinh ( g * X ) );


  R = Wxxxx + 2.0 * Wxxyy + Wyyyy;

  return
end
