function lagrange_basis_deriv2_test ( )

%*****************************************************************************80
%
%% lagrange_basis_deriv2_test() tests lagrange_basis_deriv2().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    16 July 2025
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'lagrange_basis_deriv2_test():\n' );
  fprintf ( 1, '  lagrange_basis_deriv2() evaluates the second derivative\n' );
  fprintf ( 1, '  of a Lagrange basis polynomial.\n' );

  npol = 7;
  ipol = 2;
  xpol = linspace ( -3.0, +3.0, npol );

  nplot = 101;
  xplot = linspace ( -3.3, +3.5, nplot );
  yplot = zeros ( nplot, 1 );
  for i = 1 : nplot
    yplot(i) = lagrange_basis_deriv2 ( npol, ipol, xpol, 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 ( '<-- d2/dx2 L(i)(x) -->' );
  title ( 'd2/dx2 L(i)(x) = i-th Lagrange basis polynomial second derivative' );
  filename = 'lagrange_basis_deriv2.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  close ( );

  return
end

