function spherical_harmonic_test02 ( )

%*****************************************************************************80
%
%% spherical_harmonic_test02() tests spherical_harmonic().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 October 2008
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'spherical_harmonic_test02():\n' );
  fprintf ( 1, '  spherical_harmonic() evaluates the\n' );
  fprintf ( 1, '  spherical harmonic function.\n' );
  fprintf ( 1, '  spherical_harmonic_values() returns some exact values.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '      L       M    THETA   PHI   YR   YI\n' );
  fprintf ( 1, '\n' );

  n_data = 0;

  while ( true )

    [ n_data, l, m, theta, phi, yr, yi ] = spherical_harmonic_values ( n_data );

    if ( n_data == 0 )
      break
    end

    [ c, s ] = spherical_harmonic ( l, m, theta, phi );

    fprintf ( 1, '  %6d  %6d  %6f  %6f  %12f  %12f\n', ...
      l, m, theta, phi, yr, yi );
    fprintf ( 1, '                                      %12f  %12f\n', ...
      c(l+1), s(l+1) );

  end

  return
end
