function jacobi_dnk_inverse_test ( )

%*****************************************************************************80
%
%% jacobi_dnk_inverse_test() tests jacobi_dnk_inverse().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 November 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'jacobi_dnk_inverse_test():\n' );
  fprintf ( 1, '  jacobi_dnk_inverse(u,k) is given x and k from the equation\n' );
  fprintf ( 1, '    x = dnk(u,k),\n' );
  fprintf ( 1, '  and returns the value of u.\n' );
  fprintf ( 1, '  Note that the inverse is not necessarily unique.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '        K          X=DN(U,K)     X2=DN(U2,K)        U                         U2=dnk_inverse(X,K)\n' );
  fprintf ( 1, '\n' );

  n_data = 0;

  while ( true )

    [ n_data, u, a, k, m, fx2 ] = jacobi_dn_values ( n_data );

    if ( n_data == 0 )
      break
    end

    x = jacobi_dnk ( u, k );
    u2 = jacobi_dnk_inverse ( x, k );
    x2 = jacobi_dnk ( u2, k );

    fprintf ( 1, '  %12f  %12f  %12f  %24.16f  %24.16f\n', k, x, x2, u, u2 );

  end

  return
end
