function jacobi_cnm_test ( )

%*******************************************************************************
%
%% jacobi_cnm_test() tests jacobi_cnm().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 November 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'jacobi_cnm_test():\n' );
  fprintf ( 1, '  jacobi_cnm() evaluates the Jacobi elliptic function CN(U,M).\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '    U       M       Exact CN                CN(U,M)     |Diff|\n' );
  fprintf ( 1, '\n' );

  n_data = 0;

  while ( true )

    [ n_data, u, a, k, m, cn1 ] = jacobi_cn_values ( n_data );

    if ( n_data == 0 )
      break;
    end

    cn2 = jacobi_cnm ( u, m );

    fprintf ( 1, '%8.4f%8.4f%24.16g%24.16g  %8.2g\n', u, m, cn1, cn2, abs ( cn1 - cn2 ) );

  end

  return
end
