code: def deriv1(x,y,i,n):
      
      m_,x_,y_,xy_,x_2=0.,0.,0.,0.,0.
      for ix in range(i,i+n,1):
          x_=x_+x[ix]
          y_=y_+y[ix]
          xy_=xy_+x[ix]*y[ix]
          x_2=x_2+x[ix]**2
      m= old_div(( (n*xy_) - (x_*y_) ), ( n*x_2-(x_)**2))
      return(m)
docs: alternative way to smooth the derivative of a noisy signal
      using least square fit.
      x=array of x axis
      y=array of y axis
      n=smoothing factor
      i= position
  
      in this method the slope in position i is calculated by least square fit of n points
      before and after position.