code: def fit_linear(xdata, ydata):
      
      x = _n.array(xdata)
      y = _n.array(ydata)
  
      ax  = _n.average(x)
      ay  = _n.average(y)
      axx = _n.average(x*x)
      ayx = _n.average(y*x)
  
      slope     = (ayx - ay*ax) / (axx - ax*ax)
      intercept = ay - slope*ax
  
      return slope, intercept
docs: Returns slope and intercept of line of best fit:
          
          y = a*x + b
      
      through the supplied data.
      
      Parameters
      ----------
      xdata, ydata:
          Arrays of x data and y data (having matching lengths).