function elliptic_inc_em_test ( )

%*****************************************************************************80
%
%% ELLIPTIC_INC_EM_TEST tests ELLIPTIC_INC_EM.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    21 June 2018
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'ELLIPTIC_INC_EM_TEST:\n' );
  fprintf ( 1, '  ELLIPTIC_INC_EM returns values of\n' );
  fprintf ( 1, '  the incomplete elliptic integral of the\n' );
  fprintf ( 1, '  second kind, with parameters PHI, M.\n' );
  fprintf ( 1, '  Compare with MATLAB ellipticE(phi,m)\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '          Phi             M                ellipticE(phi,m)    elliptic_inc_em(phi,m)\n' );
  fprintf ( 1, '\n' );

  seed = 123456789;

  for i = 1 : 20

    [ phi, seed ] = r8_uniform_ab ( 0.0, 0.5 * pi, seed );
    mbound = 1.0 / ( sin ( phi ) ) ^ 2;
    [ m, seed ] = r8_uniform_ab ( 0.0, mbound, seed );
    fx1 = ellipticE ( phi, m );
    fx2 = elliptic_inc_em ( phi, m );

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

  end

  return
end
