# gram_polynomial

gram_polynomial, a Python code which evaluates the Gram polynomials, also known as the discrete Chebyshev polyomials.

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^2/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))
```
where
```  x(i) = - 1 + ( 2*i-1)/m, 1 <= i <= m.
```

### Languages:

gram_polynomial is available in a MATLAB version and a Python version.

### Related Data and Programs:

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

chebyshev_polynomial, a Python 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 Python code which evaluates the Gegenbauer polynomial and associated functions.

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

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

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

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

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

### Reference:

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 11 October 2022.