def __truediv__(self, I): """ Form the quotient by an integral ideal. EXAMPLES:: sage: QQ / ZZ Q/Z """ from sage.rings.ideal import Ideal_generic from sage.groups.additive_abelian.qmodnz import QmodnZ if I is ZZ: return QmodnZ(1) elif isinstance(I, Ideal_generic) and I.base_ring() is ZZ: return QmodnZ(I.gen()) else: return super(RationalField, self).__truediv__(I)
def value_module_qf(self): r""" Return `\QQ / n\ZZ` with `n\ZZ = (V,W) + \ZZ \{ (w,w) | w \in W \}`. This is where the torsion quadratic form takes values. EXAMPLES:: sage: A2 = Matrix(ZZ, 2, 2, [2,-1,-1,2]) sage: L = IntegralLattice(2*A2) sage: D = L.discriminant_group() sage: D Finite quadratic module over Integer Ring with invariants (2, 6) Gram matrix of the quadratic form with values in Q/2Z: [ 1 1/2] [1/2 1/3] sage: D.value_module_qf() Q/2Z """ return QmodnZ(self._modulus_qf)
def value_module(self): r""" Return `\QQ / m\ZZ` with `m = (V, W)`. This is where the inner product takes values. EXAMPLES:: sage: A2 = Matrix(ZZ, 2, 2, [2,-1,-1,2]) sage: L = IntegralLattice(2*A2) sage: D = L.discriminant_group() sage: D Finite quadratic module over Integer Ring with invariants (2, 6) Gram matrix of the quadratic form with values in Q/2Z: [ 1 1/2] [1/2 1/3] sage: D.value_module() Q/Z """ return QmodnZ(self._modulus)