Function $\omega_N(x)$ arising in interpolation error

For a given set of points $x_0, x_1, \ldots, x_N \in [-1,+1]$ we plot the function $$ \omega_N(x) = (x-x_0)(x-x_1) \ldots (x-x_N), \qquad x \in [-1,+1] $$ for uniform and chebyshev points.

In [9]:
from numpy import linspace,pi,cos
from matplotlib.pyplot import plot,legend,title
In [10]:
def omega(x,xp):
    f = 1.0
    for z in xp:
        f = f * (x-z)
    return f
In [12]:
M  = 1000
xx = linspace(-1.0,1.0,M)

N = 16
xu = linspace(-1.0,1.0,N+1)    # uniform points
xc = cos(linspace(0.0,pi,N+1)) # chebyshev points
fu = 0*xx
fc = 0*xx
for i in range(M):
    fu[i] = omega(xx[i],xu)
    fc[i] = omega(xx[i],xc)
plot(xx,fu,'b-',xx,fc,'r-')
legend(("Uniform","Chebyshev"))
title("N = "+str(N))
Out[12]:
<matplotlib.text.Text at 0x10e8b4d10>