code: def center_of_mass(X, Y):
      
      X = np.asarray(X)
      Y = np.asarray(Y)
      return (X * Y).sum() / Y.sum()
docs: Get center of mass
  
      Parameters
      ----------
      X: 1d array
          X values
      Y: 1d array
          Y values
  
      Returns
      -------
      res: number
          The position of the center of mass in X
  
      Notes
      -----
      Uses least squares