The Chebyshev polynomials of the second kind are defined for $x \in (-1, 1)$ as follows

$$\ U_n(x) = \frac{\sin[ (n+1) \cdot \arccos(x) ]}{\sin(\arccos(x))} $$for $n=0,1,2,\dots$

See also:

Chebyshev polynomials of the second kind - MathWorld

Chebyshev polynomials - Wikipedia

In [1]:

```
import numpy as np
import matplotlib.pyplot as plt
```

In [2]:

```
x = np.linspace(-0.999,0.999, 2000)
```

In [3]:

```
M = 7
c = np.arange(0, M+1)
y = []
for N in c:
y.append(np.sin((N+1) * np.arccos(x)) / np.sin(np.arccos(x)))
# Here y[n] is the n-th Chebyshev polynomial i.e. it is Un(x)
# Un(x) = sin((N+1) * arccos(x)) / sin(arccos(x))
# for x in the open interval (-1, 1)
```

In [4]:

```
c
```

Out[4]:

array([0, 1, 2, 3, 4, 5, 6, 7])

In [5]:

```
fig, ax = plt.subplots(figsize=(11,8))
for i in c:
ax.plot(x, y[i], linewidth=2.0, label='$U_' + str(i) + '(x)$')
ax.set(xlim=(-1.1, 1.1),
ylim=(-10.1, 9.1))
plt.legend(loc='lower right')
plt.grid(True, linestyle='--')
plt.show()
```