import numpy as np
import matplotlib.pyplot as plt
q0 = np.random.random()
q = np.random.normal(0,1,5)
alpla = 0.00001
x = np.array([[2104,3],[1600,3],[2400,3],[1416,2],[3000,4]])
t = np.array([400,330,369,232,540])
eps = 1e-4
e0 = 999
e1 = 999
e2 = 999
b = np.random.randint(0,4)
while e0>=eps or e1>=eps or e2>=eps:
y = x[b,0:2]*q[b+1]-t[b+1]+q0
e0 = np.sum(y)
e1 = e0*x[b,0]
e2 = e0*x[b,1]
q0 = q0-alpla*e0
q1 = q1-alpla*e1
q2 = q2-alpla*e2
b +=1
print(q0, q1, q2)
0.3425420714767574 15123.242834135313 19.150660765172503