function elliptic_inc_ea_test ( )

%*****************************************************************************80
%
%% elliptic_inc_ea_test() tests elliptic_inc_ea().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 June 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'elliptic_inc_ea_test():\n' );
  fprintf ( 1, '  elliptic_inc_ea() returns values of\n' );
  fprintf ( 1, '  the incomplete elliptic integral of the\n' );
  fprintf ( 1, '  second kind, with parameters PHI, A.\n' );
  fprintf ( 1, '  Compare with MATLAB ellipticE(phi,sin^2(a*pi/180))\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '          Phi             A                ellipticE(phi,*)    elliptic_inc_ea(phi,a)\n' );
  fprintf ( 1, '\n' );

  for i = 1 : 20

    phi = 0.5 * pi * rand ( 1, 1 );
    abound = ( 180.0 / pi ) * abs ( asin ( 1.0 / sin ( phi ) ) );
    a = - abound + 2.0 * abound * rand ( 1, 1 );
    k = sin ( a * pi / 180.0 );
    fx1 = ellipticE ( phi, k^2 );
    fx2 = elliptic_inc_ek ( phi, k );

    fprintf ( 1, '  %14.6f  %14.6f  %24.16g  %24.16g\n', phi, a, fx1, fx2 );

  end

  return
end
