def __init__(self, base_ring, names, sparse=True, category=None): """ Initialize the ring. TESTS:: sage: L = LazyDirichletSeriesRing(ZZ, 't') sage: TestSuite(L).run(skip=['_test_elements', '_test_associativity', '_test_distributivity', '_test_zero']) """ if base_ring.characteristic() > 0: raise ValueError("positive characteristic not allowed for Dirichlet series") self._sparse = sparse self._coeff_ring = base_ring # TODO: it would be good to have something better than the symbolic ring self._laurent_poly_ring = SR self._internal_poly_ring = PolynomialRing(base_ring, names, sparse=True) category = Algebras(base_ring.category()) if base_ring in IntegralDomains(): category &= IntegralDomains() elif base_ring in Rings().Commutative(): category = category.Commutative() category = category.Infinite() Parent.__init__(self, base=base_ring, names=names, category=category)
def __init__(self, L, q=None): """ Initialize ``self``. TESTS:: sage: L = posets.BooleanLattice(4) sage: M = L.quantum_moebius_algebra() sage: TestSuite(M).run() # long time sage: from sage.combinat.posets.moebius_algebra import QuantumMoebiusAlgebra sage: L = posets.Crown(2) sage: QuantumMoebiusAlgebra(L) Traceback (most recent call last): ... ValueError: L must be a lattice """ if not L.is_lattice(): raise ValueError("L must be a lattice") if q is None: q = LaurentPolynomialRing(ZZ, 'q').gen() self._q = q R = q.parent() cat = Algebras(R).WithBasis() if L in FiniteEnumeratedSets(): cat = cat.Commutative().FiniteDimensional() self._lattice = L self._category = cat Parent.__init__(self, base=R, category=self._category.WithRealizations())
def __init__(self, power_series): """ Initialization EXAMPLES:: sage: K.<q> = LaurentSeriesRing(QQ, default_prec=4); K Laurent Series Ring in q over Rational Field sage: 1 / (q-q^2) q^-1 + 1 + q + q^2 + O(q^3) sage: RZZ = LaurentSeriesRing(ZZ, 't') sage: RZZ.category() Category of infinite commutative no zero divisors algebras over (euclidean domains and infinite enumerated sets and metric spaces) sage: TestSuite(RZZ).run() sage: R1 = LaurentSeriesRing(Zmod(1), 't') sage: R1.category() Category of finite commutative algebras over (finite commutative rings and subquotients of monoids and quotients of semigroups and finite enumerated sets) sage: TestSuite(R1).run() sage: R2 = LaurentSeriesRing(Zmod(2), 't') sage: R2.category() Join of Category of complete discrete valuation fields and Category of commutative algebras over (finite enumerated fields and subquotients of monoids and quotients of semigroups) and Category of infinite sets sage: TestSuite(R2).run() sage: R4 = LaurentSeriesRing(Zmod(4), 't') sage: R4.category() Category of infinite commutative algebras over (finite commutative rings and subquotients of monoids and quotients of semigroups and finite enumerated sets) sage: TestSuite(R4).run() sage: RQQ = LaurentSeriesRing(QQ, 't') sage: RQQ.category() Join of Category of complete discrete valuation fields and Category of commutative algebras over (number fields and quotient fields and metric spaces) and Category of infinite sets sage: TestSuite(RQQ).run() """ base_ring = power_series.base_ring() category = Algebras(base_ring.category()) if base_ring in Fields(): category &= CompleteDiscreteValuationFields() elif base_ring in IntegralDomains(): category &= IntegralDomains() elif base_ring in Rings().Commutative(): category = category.Commutative() if base_ring.is_zero(): category = category.Finite() else: category = category.Infinite() self._power_series_ring = power_series self._one_element = self.element_class(self, power_series.one()) CommutativeRing.__init__(self, base_ring, names=power_series.variable_names(), category=category)
def __init__(self, base_ring, names, sparse=True, category=None): """ Initialize ``self``. TESTS:: sage: L = LazyLaurentSeriesRing(ZZ, 't') sage: elts = L.some_elements()[:-2] # skip the non-exact elements sage: TestSuite(L).run(elements=elts, skip=['_test_elements', '_test_associativity', '_test_distributivity', '_test_zero']) sage: L.category() Category of infinite commutative no zero divisors algebras over (euclidean domains and infinite enumerated sets and metric spaces) sage: L = LazyLaurentSeriesRing(QQ, 't') sage: L.category() Join of Category of complete discrete valuation fields and Category of commutative algebras over (number fields and quotient fields and metric spaces) and Category of infinite sets sage: L = LazyLaurentSeriesRing(ZZ['x,y'], 't') sage: L.category() Category of infinite commutative no zero divisors algebras over (unique factorization domains and commutative algebras over (euclidean domains and infinite enumerated sets and metric spaces) and infinite sets) sage: E.<x,y> = ExteriorAlgebra(QQ) sage: L = LazyLaurentSeriesRing(E, 't') # not tested """ self._sparse = sparse self._coeff_ring = base_ring # We always use the dense because our CS_exact is implemented densely self._laurent_poly_ring = LaurentPolynomialRing(base_ring, names) self._internal_poly_ring = self._laurent_poly_ring category = Algebras(base_ring.category()) if base_ring in Fields(): category &= CompleteDiscreteValuationFields() else: if "Commutative" in base_ring.category().axioms(): category = category.Commutative() if base_ring in IntegralDomains(): category &= IntegralDomains() if base_ring.is_zero(): category = category.Finite() else: category = category.Infinite() Parent.__init__(self, base=base_ring, names=names, category=category)