function trig_lagrange_test ( nd )

%*****************************************************************************80
%
%% trig_lagrange_test() tests trig_lagrange().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 August 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer nd, the number of data points.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'trig_lagrange_test():\n' );
  fprintf ( 1, '  Generate and plot a set of trigonometric Lagrange polynomials.\n' );

  xmin = - pi;
  xmax = + pi;
  ni = 101;
  xi = linspace ( xmin, xmax, ni );

  xd = linspace ( xmin, xmax, nd + 1 );
  xd = xd(1:nd);

  clf ( );
  hold ( 'on' );

  for j = 1 : nd
    yi = trig_lagrange ( xi, xd, j );
    plot ( xi, yi, 'Linewidth', 3 );
  end

  grid ( 'on' );
  xlabel ( '<-- X -->' );
  ylabel ( '<-- Y(X) -->' );
  label = sprintf ( 'Trigonometric Lagrange family of size %d.', nd );
  title ( label );
  hold ( 'off' );

  filename = sprintf ( 'trig_lagrange_%d.png', nd );
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  pause ( 5 );

  return
end

