function line_fekete_legendre_test ( m )

%*****************************************************************************80
%
%% line_fekete_legendre_test() seeks Fekete points in [-1,+1].
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 June 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the dimension of the polynomial space.
%
  n = 5001;
  a = -1.0;
  b = +1.0;
  if ( nargin < 1 )
    m = 5;
  end
  x = linspace ( a, b, n );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'line_fekete_legendre_test():\n' );
  fprintf ( 1, '  Seek Fekete points in [%g,%g]\n', a, b );
  fprintf ( 1, '  using %d equally spaced sample points\n', n );
  fprintf ( 1, '  for polynomials of degree M = %d\n', m );
  fprintf ( 1, '  with the Legendre basis and uniform weight.\n' );

  [ nf, xf, wf, vf ] = line_fekete_legendre ( m, a, b, n, x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  NF = %d\n', nf );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Estimated Fekete points XF:\n' );
  disp ( xf );

  yf = ones ( size ( xf ) );
  plot ( xf, yf, '*' );
  title ( 'Estimated Fekete points, Legendre basis' );
  grid ( 'on' );
  filename = 'line_fekete_legendre.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  wf_sum = sum ( wf(1:nf) );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Sum(WF) = %g\n', wf_sum );

  return
end

