import numpy as np
x0, x1, x2, x3, x4 = 0, 40000, 80000, 120000, 160000
y0, y1, y2, y3, y4 = 9.8100, 9.6878, 9.5682, 9.4511, 9.3364
val = 77000

M = np.vander([x0, x1, x2, x3, x4], increasing=True)
N = np.array([y0, y1, y2, y3, y4])
Coef = np.linalg.solve(M, N)

res = sum(Coef[i] * (val ** i) for i in range(5))
print("El resultado para el valor de", val, "es", res)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: