Virial theorem and hypervirial theorem in a spherical geometry