Algo and Math

interpolazione in python. Un esempio

import numpy as np

def fun(x):
return (5*x**2+9*x+10)/12

x = np.array([-2, 1, 2])
y = np.array([1, 2, 4])

a = np.array([1, 2, 3])

import matplotlib.pyplot as plt
z = np.linspace(-3, 4, 100)
plt.plot(z, fun(z), '-', x, y, '')
plt.show()

Exit mobile version