import numpy as np
import matplotlib.pyplot as plt

L = np.array([932, 832, 732, 632, 532])
dx = np.array([3.56, 3.67, 3.00, 3.11, 2.33])

K, b = np.polyfit(L, dx, 1)

lambda_nm = 632.82
lambda_mm = lambda_nm * 1e-6

d = lambda_mm / K

plt.figure()
plt.scatter(L, dx)
plt.plot(L, K * L + b)
plt.xlabel("L, мм")
plt.ylabel("Δx, мм")
plt.savefig("1.png", bbox_inches="tight", dpi=300)
plt.show()

print(K, d)

