gram_polynomial, a MATLAB code which evaluates the Gram polynomials.

The Gram polynomial P(n,m,x) can be evaluated at a point x by:

        P(0,m,x) = 1
        P(1,m,x) = x
        P(n+1,m,x) = x * P(n,m,x) - beta(n,m) * P(n-1,m,x)
where beta(n,m) = (m^2-n^2)*n^s/m^2/(4*n^2-1).

The polynomials are orthogonal with respect to a discrete inner product

  (f,g) = sum ( 1 <= i <= m ) f(x(i)) * g(x(i))
  x(i) = - 1 + ( 2*i-1)/m, 1 <= i <= m.


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


gram_polynomial is available in a MATLAB version.

Related Data and Programs:

bernstein_polynomial, a MATLAB code which evaluates the Bernstein polynomials, useful for uniform approximation of functions;

chebyshev_polynomial, a MATLAB code which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). Functions are provided to evaluate the polynomials, determine their zeros, produce their polynomial coefficients, produce related quadrature rules, project other functions onto these polynomial bases, and integrate double and triple products of the polynomials.

gegenbauer_polynomial, a MATLAB code which evaluates the Gegenbauer polynomial and associated functions.


hermite_polynomial, a MATLAB code which evaluates the physicist's Hermite polynomial, the probabilist's Hermite polynomial, the Hermite function, and related functions.

jacobi_polynomial, a MATLAB code which evaluates the Jacobi polynomial and associated functions.

laguerre_polynomial, a MATLAB code which evaluates the Laguerre polynomial, the generalized Laguerre polynomial, and the Laguerre function.

legendre_polynomial, a MATLAB code which evaluates the Legendre polynomial and associated functions.

legendre_product_polynomial, a MATLAB code which defines Legendre product polynomials, creating a multivariate polynomial as the product of univariate Legendre polynomials.

legendre_shifted_polynomial, a MATLAB code which evaluates the shifted Legendre polynomial, with domain [0,1].

lobatto_polynomial, a MATLAB code which evaluates Lobatto polynomials, similar to Legendre polynomials except that they are zero at both endpoints.

polpak, a MATLAB code which evaluates a variety of mathematical functions.

test_values, a MATLAB code which supplies test values of various mathematical functions.


  1. Germund Dahlquist, Ake Bjorck, Numerical Methods in Scientific Computing, Volume 1, SIAM, 2008, ISBN: 978-0-898716-44-3, LC: QA297.D335 2008.

Source Code:

Last revised on 28 June 2019.