function ypp = humps_deriv2 ( x )

%*****************************************************************************80
%
%% humps_deriv2() evaluates the second derivative of the humps function.
%
%  Discussion:
%
%    y = 1.0 ./ ( ( x - 0.3 ).^2 + 0.01 ) ...
%      + 1.0 ./ ( ( x - 0.9 ).^2 + 0.04 ) ...
%      - 6.0;
%
%    yp = - 2.0 .* ( x - 0.3 ) ./ ( ( x - 0.3 ).^2 + 0.01 ).^2 ...
%         - 2.0 .* ( x - 0.9 ) ./ ( ( x - 0.9 ).^2 + 0.04 ).^2;
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 August 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real x(): the arguments.
%
%  Output:
%
%    real ypp(): the value of the second derivative at x.
%
  u1 = - 2.0 .* ( x - 0.3 );
  v1 = ( ( x - 0.3 ).^2 + 0.01 ).^2;
  u2 = - 2.0 .* ( x - 0.9 );
  v2 = ( ( x - 0.9 ).^2 + 0.04 ).^2;

  u1p = - 2.0;
  v1p = 2.0 * ( ( x - 0.3 ).^2 + 0.01 ) * 2.0 .* ( x - 0.3 ); 
  u2p = - 2.0;
  v2p = 2.0 * ( ( x - 0.9 ).^2 + 0.04 ) * 2.0 .* ( x - 0.9 );

  ypp = ( u1p .* v1 - u1 .* v1p ) ./ v1.^2 ...
      + ( u2p .* v2 - u2 .* v2p ) ./ v2.^2;

  return
end
