function lagrange_basis_antideriv_test ( )

%*****************************************************************************80
%
%% lagrange_basis_antideriv_test() tests lagrange_basis_antideriv().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 August 2025
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'lagrange_basis_antideriv_test():\n' );
  fprintf ( 1, '  lagrange_basis_antideriv() evaluates the antiderivative\n' );
  fprintf ( 1, '  of a Lagrange basis polynomial.\n' );

  npol = 7;
  ipol = 2;
  xpol = linspace ( -3.0, +3.0, npol );
%
%  Get coefficients of antiderivative.
%
  pcof_antideriv = lagrange_basis_antideriv ( npol, ipol, xpol )

  nplot = 101;
  xplot = linspace ( -3.3, +3.5, nplot );
  yplot = zeros ( nplot, 1 );

  for i = 1 : nplot
    yplot(i) = r8poly_value ( npol, pcof_antideriv, xplot(i) );
  end

  clf ( );
  hold ( 'on' );
    plot ( xplot, yplot, 'b-', 'linewidth', 2 );
    plot ( [ -3.3, +3.5 ], [ 0.0, 0.0 ], 'k--' );
    for i = 1 : npol
      plot ( xpol(i), 0.0, 'r.', 'markersize', 25 );
    end
  hold ( 'off' );
  grid ( 'On' );
  xlabel ( '<-- X -->' );
  ylabel ( '<-- Antideriv(L(i)(X)) -->' );
  title ( 'Antideriv(L(i)(X)) = i-th Lagrange basis antiderivative' );
  filename = 'lagrange_basis_antideriv.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  close ( );

  return
end

