In [15]:
import numpy as np
import matplotlib.pyplot as plt

def main():
  
  X = np.array([2.0,3.0,4.0])
  Y = np.array([5.0,6.0,9.0])

  A = np.array([X,np.ones(len(X))])
  AT = A.T
  a,b = np.linalg.lstsq(AT,Y,rcond=None)[0]

  plt.plot(X,Y,"ro")
  plt.plot(X, (a*X+b),"g--")
  plt.title("a="+ str(a) + ", b=" + str(b) )
  plt.grid()
  plt.show()

if __name__ == '__main__':
    main()