This notebook illustrates the relation between Fourier modes on the unit circle and Chebyshev polynomials.
%matplotlib notebook
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from numpy import *
k = 15 # wave number. Try 1, 2
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
theta = linspace(0, 2*pi, 1000)
x = cos(theta)
y = sin(theta)
z = cos(k*theta)
ax.plot(x,y,z,'b')
ax.plot(x,y,0*z,'k') # plot unit circle
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.draw()
If you run this notebook you should be able to rotate the figure above. If you view it in the $x$-$z$ plane, you get the figure below.
Plotting $z = \cos(k \theta)$ as a function of $x = \cos(\theta)$ gives the Chebyshev polynomial $T_k(x)$:
plt.figure(figsize=(10,5))
plt.plot(x,z)
plt.plot([-1,1],[0,0],'k')
[<matplotlib.lines.Line2D at 0x108b43190>]
Because of the relation between Chebyshev polynomials and Fourier modes on the unit circle, aliasing takes place as described in ATAP Theorem 4.1 and illustrated below.
n = 7 # Use Chebyshev grid with n+1 points
k = 17 # Start with T_k
m = abs(mod(k+n-1,2*n) - (n-1)) # aliased to T_m
# Fine grid for plotting polynomials:
theta = linspace(0, pi, 500)
x = cos(theta)
Tk = cos(k*theta)
Tm = cos(m*theta)
# Grid points:
theta_j = linspace(0, pi, n+1)
xj = cos(theta_j)
Tk_j = cos(k*theta_j)
plt.figure()
plt.plot(x,Tk,'b')
plt.plot(xj, Tk_j, 'bo')
plt.plot(x,Tm,'r')
plt.title("The Chebyshev polynomial T_{%s} gets aliased to T_{%s}" % (k,m))
<matplotlib.text.Text at 0x10bf89e10>
Note that each Chebyshev point in the interval (with the exception of the endpoints) maps to two points on the unit circle. Below only one of these points is plotted.
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
theta = linspace(0, 2*pi, 1000)
x = cos(theta)
y = sin(theta)
Tk = cos(k*theta)
Tm = cos(m*theta)
ax.plot(x,y,Tm,'b')
ax.plot(x,y,Tk,'r')
ax.plot(x,y,0*Tm,'k') # plot unit circle
theta_j = linspace(0, pi, n+1)
xj = cos(theta_j)
yj = sin(theta_j)
Tk_j = cos(k*theta_j)
ax.plot(xj, yj, Tk_j, 'bo')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.draw()