# Monomial interpolation¶

In [3]:
#keep
import numpy as np

import numpy.linalg as la
import matplotlib.pyplot as pt
%matplotlib inline

In [4]:
#keep
x = np.linspace(0, 1, 200)


Now plot the monomial basis on the interval [0,1] up to $x^9$.

In [5]:
#keep
n = 10

for i in range(n):
pt.plot(x, x**i)

pt.vlines(np.linspace(0, 1, n), 0, 1, alpha=0.5, linestyle="--")

Out[5]:
<matplotlib.collections.LineCollection at 0x10564e160>
• How do the entries of the Vandermonde matrix relate to this plot?

• Guess the condition number of the Vandermonde matrix for $n=5,10,20$:
In [6]:
#keep
n = 5

V = np.array([np.linspace(0, 1, n)**i for i in range(n)]).T
la.cond(V)

Out[6]:
686.43494181859796
In [ ]: