def construction(self): """ Returns the functorial construction of ``self``, namely, completion of the rational numbers with respect a given prime. Also preserves other information that makes this field unique (e.g. precision, rounding, print mode). EXAMPLE:: sage: K = Qp(17, 8, print_mode='val-unit', print_sep='&') sage: c, L = K.construction(); L Rational Field sage: c(L) 17-adic Field with capped relative precision 8 sage: K == c(L) True """ from sage.categories.pushout import CompletionFunctor return (CompletionFunctor( self.prime(), self.precision_cap(), { 'print_mode': self._printer.dict(), 'type': self._prec_type(), 'names': self._names }), QQ)
def construction(self): r""" Return the functorial construction of this Laurent power series ring. The construction is given as the completion of the Laurent polynomials. EXAMPLES:: sage: L.<t> = LaurentSeriesRing(ZZ, default_prec=42) sage: phi, arg = L.construction() sage: phi Completion[t, prec=42] sage: arg Univariate Laurent Polynomial Ring in t over Integer Ring sage: phi(arg) is L True Because of this construction, pushout is automatically available:: sage: 1/2 * t 1/2*t sage: parent(1/2 * t) Laurent Series Ring in t over Rational Field sage: QQbar.gen() * t I*t sage: parent(QQbar.gen() * t) Laurent Series Ring in t over Algebraic Field """ from sage.categories.pushout import CompletionFunctor from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing L = LaurentPolynomialRing(self.base_ring(), self._names[0]) return CompletionFunctor(self._names[0], self.default_prec()), L
def construction(self, forbid_frac_field=False): """ Returns the functorial construction of ``self``, namely, completion of the rational numbers with respect a given prime. Also preserves other information that makes this field unique (e.g. precision, rounding, print mode). INPUT: - ``forbid_frac_field`` -- require a completion functor rather than a fraction field functor. This is used in the :meth:`sage.rings.padics.local_generic.LocalGeneric.change` method. EXAMPLES:: sage: K = Qp(17, 8, print_mode='val-unit', print_sep='&') sage: c, L = K.construction(); L 17-adic Ring with capped relative precision 8 sage: c FractionField sage: c(L) 17-adic Field with capped relative precision 8 sage: K == c(L) True We can get a completion functor by forbidding the fraction field:: sage: c, L = K.construction(forbid_frac_field=True); L Rational Field sage: c Completion[17, prec=8] sage: c(L) 17-adic Field with capped relative precision 8 sage: K == c(L) True TESTS:: sage: R = QpLC(13,(31,41)) sage: R._precision_cap() (31, 41) sage: F, Z = R.construction() sage: S = F(Z) sage: S._precision_cap() (31, 41) """ from sage.categories.pushout import FractionField, CompletionFunctor if forbid_frac_field: extras = { 'print_mode': self._printer.dict(), 'type': self._prec_type(), 'names': self._names } if hasattr(self, '_label'): extras['label'] = self._label return (CompletionFunctor(self.prime(), self._precision_cap(), extras), QQ) else: return FractionField(), self.integer_ring()
def construction(self): """ Return the functorial construction of self, namely, completion of the univariate polynomial ring with respect to the indeterminate (to a given precision). EXAMPLES:: sage: R = PowerSeriesRing(ZZ, 'x') sage: c, S = R.construction(); S Univariate Polynomial Ring in x over Integer Ring sage: R == c(S) True sage: R = PowerSeriesRing(ZZ, 'x', sparse=True) sage: c, S = R.construction() sage: R == c(S) True """ from sage.categories.pushout import CompletionFunctor if self.is_sparse(): extras = {'sparse': True} else: extras = None return CompletionFunctor(self._names[0], self.default_prec(), extras), self._poly_ring()
def construction(self): """ Returns the functorial construction of ``self``, namely, completion of the rational numbers with respect a given prime. Also preserves other information that makes this field unique (e.g. precision, rounding, print mode). EXAMPLES:: sage: K = Qp(17, 8, print_mode='val-unit', print_sep='&') sage: c, L = K.construction(); L Rational Field sage: c(L) 17-adic Field with capped relative precision 8 sage: K == c(L) True TESTS:: sage: R = QpLC(13,(31,41)) sage: R._precision_cap() (31, 41) sage: F, Z = R.construction() sage: S = F(Z) sage: S._precision_cap() (31, 41) """ from sage.categories.pushout import CompletionFunctor extras = {'print_mode':self._printer.dict(), 'type':self._prec_type(), 'names':self._names} if hasattr(self, '_label'): extras['label'] = self._label return (CompletionFunctor(self.prime(), self._precision_cap(), extras), QQ)
def construction(self): """ Returns a functor F and base ring R such that F(R) == self. EXAMPLES:: sage: M = PowerSeriesRing(QQ,4,'f'); M Multivariate Power Series Ring in f0, f1, f2, f3 over Rational Field sage: (c,R) = M.construction(); (c,R) (Completion[('f0', 'f1', 'f2', 'f3'), prec=12], Multivariate Polynomial Ring in f0, f1, f2, f3 over Rational Field) sage: c Completion[('f0', 'f1', 'f2', 'f3'), prec=12] sage: c(R) Multivariate Power Series Ring in f0, f1, f2, f3 over Rational Field sage: c(R) == M True TESTS:: sage: M2 = PowerSeriesRing(QQ,4,'f', sparse=True) sage: M == M2 False sage: c,R = M2.construction() sage: c(R)==M2 True sage: M3 = PowerSeriesRing(QQ,4,'f', order='degrevlex') sage: M3 == M False sage: M3 == M2 False sage: c,R = M3.construction() sage: c(R)==M3 True """ from sage.categories.pushout import CompletionFunctor extras = {'order': self.term_order(), 'num_gens': self.ngens()} if self.is_sparse(): extras['sparse'] = True return (CompletionFunctor(self._names, self.default_prec(), extras=extras), self._poly_ring())
def construction(self, forbid_frac_field=False): """ Returns the functorial construction of self, namely, completion of the rational numbers with respect a given prime. Also preserves other information that makes this field unique (e.g. precision, rounding, print mode). INPUT: - ``forbid_frac_field`` -- ignored, for compatibility with other p-adic types. EXAMPLES:: sage: K = Zp(17, 8, print_mode='val-unit', print_sep='&') sage: c, L = K.construction(); L Integer Ring sage: c(L) 17-adic Ring with capped relative precision 8 sage: K == c(L) True TESTS:: sage: R = ZpLC(13,(31,41)) sage: R._precision_cap() (31, 41) sage: F, Z = R.construction() sage: S = F(Z) sage: S._precision_cap() (31, 41) """ from sage.categories.pushout import CompletionFunctor extras = { 'print_mode': self._printer.dict(), 'type': self._prec_type(), 'names': self._names } if hasattr(self, '_label'): extras['label'] = self._label return (CompletionFunctor(self.prime(), self._precision_cap(), extras), ZZ)
def construction(self): """ Returns a functor F and base ring R such that F(R) == self. EXAMPLES:: sage: M = PowerSeriesRing(QQ,4,'f'); M Multivariate Power Series Ring in f0, f1, f2, f3 over Rational Field sage: (c,R) = M.construction(); (c,R) (Completion[('f0', 'f1', 'f2', 'f3')], Multivariate Polynomial Ring in f0, f1, f2, f3 over Rational Field) sage: c Completion[('f0', 'f1', 'f2', 'f3')] sage: c(R) Multivariate Power Series Ring in f0, f1, f2, f3 over Rational Field sage: c(R) == M True """ from sage.categories.pushout import CompletionFunctor return (CompletionFunctor(self._names, self.default_prec()), self._poly_ring())