function value = elliptic_fk ( k )

%*****************************************************************************80
%
%% ELLIPTIC_FK evaluates the complete elliptic integral F(K).
%
%  Discussion:
%
%    The value is computed using Carlson elliptic integrals:
%
%      F(k) = RF ( 0, 1-k^2, 1 ).
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    22 June 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real K, the argument.
%
%    Output, real VALUE, the function value.
%
  x = 0.0;
  y = ( 1.0 - k ) * ( 1.0 + k );
  z = 1.0;
  errtol = 1.0E-03;

  [ value, ierr ] = rf ( x, y, z, errtol );
  if ( ierr ~= 0 )
    fprintf ( 1, 'ELLIPTIC_FK - Fatal error!\n' );
    fprintf ( 1, '  RF returned IERR = %d\n', ierr );
    error ( 'ELLIPTIC_FK - Fatal error!' );
    return
  end

  return
end
