function monomial_dot_product ( i, j )

%*****************************************************************************80
%
%% monoial_dot_product: dot product of the i and j monomials.
%
%  Input:
%
%    integer i, j: the indices of the two polynomials.
%
%  Output:
%
%    real n1, n2: the L2 norms of x^i and x^j over [-1,+1].
%
%    real q: the L2 dot product of x^i and x^j over [-1,+1];
%
%    real r: the "relative" L2 dot product of x^i and x^j over [-1,+1].
%
  q = integral ( @(x) x.^i .* x.^j, -1.0, +1.0 );
  ni = sqrt ( integral ( @(x) (x.^i).^2, -1.0, +1.0 ) );
  nj = sqrt ( integral ( @(x) (x.^j).^2, -1.0, +1.0 ) );
  r = q / ni / nj;
  angle = acos ( r ) * 180.0 / pi;

  fprintf ( '\n' );
  fprintf ( ' ||M%d(x)|| = %g\n', i, ni );
  fprintf ( ' ||M%d(x)|| = %g\n', j, nj );
  fprintf ( ' <M%d(x),M%d(x)> = %g\n', i, j, q );
  fprintf ( ' <M%d(x),M%d(x)> / ||M%d(x)|| / ||M%d(x)|| = %g\n', i, j, i, j, r );
  fprintf ( ' Angle = %g degrees\n', angle );
  
  return
end

