function r8_sincos_sum_test ( )

%*****************************************************************************80
%
%% R8_SINCOS_SUM_TEST tests R8_SINCOS_SUM.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    18 January 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8_SINCOS_SUM_TEST\n' );
  fprintf ( 1, '  R8_SINCOS_SUM simplifies a linear sine and cosine sum\n' );

  seed = 123456789;
  [ a, seed ] = r8_uniform_ab ( -5.0, +5.0, seed );
  [ b, seed ] = r8_uniform_ab ( -5.0, +5.0, seed );
  [ c, seed ] = r8_uniform_ab ( -5.0, +5.0, seed );

  [ d, e, f ] = r8_sincos_sum ( a, b );

  fprintf ( 1, '\n' );
  fprintf ( 1, '    %g * sin ( %g * x ) + %g * cos ( %g * x )\n', a, c, b, c );
  fprintf ( 1, '  = %g * sin ( %g * x + %g )\n', d, c, e );
  fprintf ( 1, '  = %g * cos ( %g * x + %g )\n', d, c, f );

  x = linspace ( 0.0, pi, 11 );
  y1 = a * sin ( c * x ) + b * cos ( c * x );
  y2 = d * sin ( c * x + e );
  y3 = d * cos ( c * x + f );

  fprintf ( 1, '\n' );
  fprintf ( 1, '   I      X              form 1        form 2        form 3\n' );
  fprintf ( 1, '\n' );

  for i = 1 : 11
    fprintf ( 1, '  %2d  %10f  %12.6g  %12.6g  %12.6g\n', i, x(i), y1(i), y2(i), y3(i) );
  end

  return
end

