code: def mass_3d(self, R, Rs, rho0, r_trunc):
          
  
          x = R * Rs ** -1
  
          func = (r_trunc ** 2 * (-2 * x * (1 + r_trunc ** 2) + 4 * (1 + x) * r_trunc * np.arctan(x / r_trunc) -
                                  2 * (1 + x) * (-1 + r_trunc ** 2) * np.log(Rs) + 2 * (1 + x) * (-1 + r_trunc ** 2) * np.log(Rs * (1 + x)) +
                                  2 * (1 + x) * (-1 + r_trunc ** 2) * np.log(Rs * r_trunc) -
                                  (1 + x) * (-1 + r_trunc ** 2) * np.log(Rs ** 2 * (x ** 2 + r_trunc ** 2)))) / (2. * (1 + x) * (1 + r_trunc ** 2) ** 2)
  
          m_3d = 4*np.pi*Rs ** 3 * rho0 * func
          return m_3d
docs: mass enclosed a 3d sphere or radius r
  
          :param r:
          :param Ra:
          :param Rs:
          :return: