Skip to content

Commit 32b17a3

Browse files
committed
Parent in asymptotics
1 parent c8a3ca1 commit 32b17a3

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,22 +185,23 @@
185185
Classes and Methods
186186
===================
187187
"""
188-
#*****************************************************************************
188+
# ****************************************************************************
189189
# Copyright (C) 2008 Alexander Raichev <[email protected]>
190190
# Copyright (C) 2014, 2016 Daniel Krenn <[email protected]>
191191
#
192192
# This program is free software: you can redistribute it and/or modify
193193
# it under the terms of the GNU General Public License as published by
194194
# the Free Software Foundation, either version 2 of the License, or
195195
# (at your option) any later version.
196-
# http://www.gnu.org/licenses/
197-
#*****************************************************************************
196+
# https://www.gnu.org/licenses/
197+
# ****************************************************************************
198198

199199
from functools import total_ordering
200200
from itertools import combinations_with_replacement
201+
201202
from sage.structure.element import RingElement
202203
from sage.structure.unique_representation import UniqueRepresentation
203-
from sage.rings.ring import Ring
204+
from sage.structure.parent import Parent
204205
from sage.calculus.var import var
205206
from sage.calculus.functional import diff
206207
from sage.symbolic.ring import SR
@@ -1507,7 +1508,7 @@ def asymptotic_decomposition(self, alpha, asy_var=None):
15071508
for f in decomp2:
15081509
ff = self.parent()((f.numerator() /
15091510
cauchy_stuff).simplify_full().collect(asy_var),
1510-
f.denominator_factored())
1511+
f.denominator_factored())
15111512
decomp3.append(ff)
15121513

15131514
return decomp3
@@ -2248,9 +2249,9 @@ def asymptotics_multiple(self, p, alpha, N, asy_var, coordinate=None,
22482249
if verbose:
22492250
print("Computing derivatives of auxiliary functions...")
22502251
m = min(n, N)
2251-
end = [X[d-1] for j in range(n)]
2252+
end = [X[d - 1] for j in range(n)]
22522253
Hprodderivs = diff_all(Hprod, X, 2 * N - 2 + n, ending=end, sub_final=P)
2253-
atP.update({U.subs(P): diff(Hprod, X[d - 1], n).subs(P)/factorial(n)})
2254+
atP.update({U.subs(P): diff(Hprod, X[d - 1], n).subs(P) / factorial(n)})
22542255
Uderivs = {}
22552256
k = Hprod.polynomial(CC).degree() - n
22562257
if k == 0:
@@ -2327,7 +2328,7 @@ def asymptotics_multiple(self, p, alpha, N, asy_var, coordinate=None,
23272328
(-1) ** (q - j - k)
23282329
for (j, k) in product(range(min(n - 1, q) + 1),
23292330
range(max(0, q - n),
2330-
q + 1))
2331+
q + 1))
23312332
if j + k <= q])
23322333
for q in range(N)])
23332334
chunk = chunk.subs(P).simplify()
@@ -2936,7 +2937,7 @@ def relative_error(self, approx, alpha, interval, exp_scale=Integer(1),
29362937
alpha = vector(alpha)
29372938
multi_indices = [r * alpha for r in interval]
29382939
mac = self.maclaurin_coefficients(multi_indices, numerical=digits)
2939-
#mac = self.old_maclaurin_coefficients(alpha, max(interval))
2940+
# mac = self.old_maclaurin_coefficients(alpha, max(interval))
29402941
mac_approx = {}
29412942
stats = []
29422943
for r in interval:
@@ -3010,7 +3011,7 @@ def _mul_(left, right):
30103011
return left.parent()(numer, df)
30113012

30123013

3013-
class FractionWithFactoredDenominatorRing(UniqueRepresentation, Ring):
3014+
class FractionWithFactoredDenominatorRing(UniqueRepresentation, Parent):
30143015
r"""
30153016
This is the ring of fractions with factored denominator.
30163017
@@ -3053,7 +3054,8 @@ def __classcall_private__(cls, denominator_ring, numerator_ring=None, category=N
30533054
sage: from sage.rings.asymptotic.asymptotics_multivariate_generating_functions import FractionWithFactoredDenominatorRing
30543055
sage: R.<x,y> = PolynomialRing(QQ)
30553056
sage: FFPD1 = FractionWithFactoredDenominatorRing(R)
3056-
sage: FFPD2 = FractionWithFactoredDenominatorRing(R, R, Rings())
3057+
sage: cat = Rings().Commutative()
3058+
sage: FFPD2 = FractionWithFactoredDenominatorRing(R, R, cat)
30573059
sage: FFPD1 is FFPD2
30583060
True
30593061
"""
@@ -3063,7 +3065,7 @@ def __classcall_private__(cls, denominator_ring, numerator_ring=None, category=N
30633065
raise ValueError('numerator ring {} has no coercion map from the '
30643066
'denominator ring {}'.format(
30653067
numerator_ring, denominator_ring))
3066-
category = Rings().or_subcategory(category)
3068+
category = Rings().Commutative().or_subcategory(category)
30673069
return super().__classcall__(cls, denominator_ring,
30683070
numerator_ring, category)
30693071

@@ -3081,11 +3083,11 @@ def __init__(self, denominator_ring, numerator_ring=None, category=None):
30813083
"""
30823084
self._numerator_ring = numerator_ring
30833085
self._denominator_ring = denominator_ring
3084-
Ring.__init__(self, denominator_ring, category=category)
3086+
Parent.__init__(self, denominator_ring, category=category)
30853087

30863088
def _repr_(self):
30873089
r"""
3088-
Returns a representation.
3090+
Return a representation.
30893091
30903092
OUTPUT:
30913093
@@ -3614,7 +3616,7 @@ def sum(self):
36143616

36153617

36163618
#####################################################################
3617-
## Helper functions
3619+
# Helper functions
36183620

36193621

36203622
def diff_prod(f_derivs, u, g, X, interval, end, uderivs, atc):
@@ -3829,7 +3831,7 @@ def subs_all(f, sub, simplify=False):
38293831

38303832

38313833
def diff_all(f, V, n, ending=[], sub=None, sub_final=None,
3832-
zero_order=0, rekey=None):
3834+
zero_order=0, rekey=None):
38333835
r"""
38343836
Return a dictionary of representative mixed partial
38353837
derivatives of `f` from order 1 up to order `n` with respect to the

0 commit comments

Comments
 (0)