function value = gram_projection ( f, j, m )

%*****************************************************************************80
%
%% gram_projectioin: projection of function onto Gram polynomial gj.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 June 2019
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Germund Dahlquist, Ake Bjorck,
%    Numerical Methods in Scientific Computing,
%    Volume 1,
%    SIAM, 2008,
%    ISBN: 978-0-898716-44-3,
%    LC: QA297.D335 2008.
%    
%  Input:
%
%    integer f, a handle for the function.
%
%    integer j, the index of the Gram polynomial.
%    j < m.
%
%    integer m, the number of points used in defining the polynomials.
%
%  Output:
%
%    real value, the value of the inner product (f,gj).
%
  x = gram_abscissas ( m );
  fi = f ( x );
  gj = gram_polynomial_evaluate ( j, m, x );
  value = ( fi' * gj ) / ( gj' * gj );

  return
end

