Dati 2 Array, interpolazione e matrice
import numpy as np
#dati due array
x = np.array([0, 0.1, 0.8, 1])
y = np.array([1, -0.0, 10, 9])
n = 4
#matrice di vandermonde
#base monomiale
B = np.zeros([n, n])
for j in range(0, n):
B[:, j] = x**(j)
print(B)
import scipy.linalg as las
p = las.solve(B, y)
print(p)
xx = np.linspace(-0.1, 1.1, 200)
yd = np.array([1., -17.17, 76.96, -51.78])
yd1 = p[0]+p[1]*xx+p[2]*xx**2+p[3]*xx**3
import matplotlib.pyplot as plt
plt.plot(xx, yd1, x, y, 'o')
plt.show()