code: def lin_interp(x, rangeX, rangeY):
      
      s = (x - rangeX[0]) / mag(rangeX[1] - rangeX[0])
      y = rangeY[0] * (1 - s) + rangeY[1] * s
      return y
docs: Interpolate linearly variable x in rangeX onto rangeY.