185
185
Classes and Methods
186
186
===================
187
187
"""
188
- #* ****************************************************************************
188
+ # ****************************************************************************
189
189
# Copyright (C) 2008 Alexander Raichev <[email protected] >
190
190
# Copyright (C) 2014, 2016 Daniel Krenn <[email protected] >
191
191
#
192
192
# This program is free software: you can redistribute it and/or modify
193
193
# it under the terms of the GNU General Public License as published by
194
194
# the Free Software Foundation, either version 2 of the License, or
195
195
# (at your option) any later version.
196
- # http ://www.gnu.org/licenses/
197
- #* ****************************************************************************
196
+ # https ://www.gnu.org/licenses/
197
+ # ****************************************************************************
198
198
199
199
from functools import total_ordering
200
200
from itertools import combinations_with_replacement
201
+
201
202
from sage .structure .element import RingElement
202
203
from sage .structure .unique_representation import UniqueRepresentation
203
- from sage .rings . ring import Ring
204
+ from sage .structure . parent import Parent
204
205
from sage .calculus .var import var
205
206
from sage .calculus .functional import diff
206
207
from sage .symbolic .ring import SR
@@ -1507,7 +1508,7 @@ def asymptotic_decomposition(self, alpha, asy_var=None):
1507
1508
for f in decomp2 :
1508
1509
ff = self .parent ()((f .numerator () /
1509
1510
cauchy_stuff ).simplify_full ().collect (asy_var ),
1510
- f .denominator_factored ())
1511
+ f .denominator_factored ())
1511
1512
decomp3 .append (ff )
1512
1513
1513
1514
return decomp3
@@ -2248,9 +2249,9 @@ def asymptotics_multiple(self, p, alpha, N, asy_var, coordinate=None,
2248
2249
if verbose :
2249
2250
print ("Computing derivatives of auxiliary functions..." )
2250
2251
m = min (n , N )
2251
- end = [X [d - 1 ] for j in range (n )]
2252
+ end = [X [d - 1 ] for j in range (n )]
2252
2253
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 )})
2254
2255
Uderivs = {}
2255
2256
k = Hprod .polynomial (CC ).degree () - n
2256
2257
if k == 0 :
@@ -2327,7 +2328,7 @@ def asymptotics_multiple(self, p, alpha, N, asy_var, coordinate=None,
2327
2328
(- 1 ) ** (q - j - k )
2328
2329
for (j , k ) in product (range (min (n - 1 , q ) + 1 ),
2329
2330
range (max (0 , q - n ),
2330
- q + 1 ))
2331
+ q + 1 ))
2331
2332
if j + k <= q ])
2332
2333
for q in range (N )])
2333
2334
chunk = chunk .subs (P ).simplify ()
@@ -2936,7 +2937,7 @@ def relative_error(self, approx, alpha, interval, exp_scale=Integer(1),
2936
2937
alpha = vector (alpha )
2937
2938
multi_indices = [r * alpha for r in interval ]
2938
2939
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))
2940
2941
mac_approx = {}
2941
2942
stats = []
2942
2943
for r in interval :
@@ -3010,7 +3011,7 @@ def _mul_(left, right):
3010
3011
return left .parent ()(numer , df )
3011
3012
3012
3013
3013
- class FractionWithFactoredDenominatorRing (UniqueRepresentation , Ring ):
3014
+ class FractionWithFactoredDenominatorRing (UniqueRepresentation , Parent ):
3014
3015
r"""
3015
3016
This is the ring of fractions with factored denominator.
3016
3017
@@ -3053,7 +3054,8 @@ def __classcall_private__(cls, denominator_ring, numerator_ring=None, category=N
3053
3054
sage: from sage.rings.asymptotic.asymptotics_multivariate_generating_functions import FractionWithFactoredDenominatorRing
3054
3055
sage: R.<x,y> = PolynomialRing(QQ)
3055
3056
sage: FFPD1 = FractionWithFactoredDenominatorRing(R)
3056
- sage: FFPD2 = FractionWithFactoredDenominatorRing(R, R, Rings())
3057
+ sage: cat = Rings().Commutative()
3058
+ sage: FFPD2 = FractionWithFactoredDenominatorRing(R, R, cat)
3057
3059
sage: FFPD1 is FFPD2
3058
3060
True
3059
3061
"""
@@ -3063,7 +3065,7 @@ def __classcall_private__(cls, denominator_ring, numerator_ring=None, category=N
3063
3065
raise ValueError ('numerator ring {} has no coercion map from the '
3064
3066
'denominator ring {}' .format (
3065
3067
numerator_ring , denominator_ring ))
3066
- category = Rings ().or_subcategory (category )
3068
+ category = Rings ().Commutative (). or_subcategory (category )
3067
3069
return super ().__classcall__ (cls , denominator_ring ,
3068
3070
numerator_ring , category )
3069
3071
@@ -3081,11 +3083,11 @@ def __init__(self, denominator_ring, numerator_ring=None, category=None):
3081
3083
"""
3082
3084
self ._numerator_ring = numerator_ring
3083
3085
self ._denominator_ring = denominator_ring
3084
- Ring .__init__ (self , denominator_ring , category = category )
3086
+ Parent .__init__ (self , denominator_ring , category = category )
3085
3087
3086
3088
def _repr_ (self ):
3087
3089
r"""
3088
- Returns a representation.
3090
+ Return a representation.
3089
3091
3090
3092
OUTPUT:
3091
3093
@@ -3614,7 +3616,7 @@ def sum(self):
3614
3616
3615
3617
3616
3618
#####################################################################
3617
- ## Helper functions
3619
+ # Helper functions
3618
3620
3619
3621
3620
3622
def diff_prod (f_derivs , u , g , X , interval , end , uderivs , atc ):
@@ -3829,7 +3831,7 @@ def subs_all(f, sub, simplify=False):
3829
3831
3830
3832
3831
3833
def diff_all (f , V , n , ending = [], sub = None , sub_final = None ,
3832
- zero_order = 0 , rekey = None ):
3834
+ zero_order = 0 , rekey = None ):
3833
3835
r"""
3834
3836
Return a dictionary of representative mixed partial
3835
3837
derivatives of `f` from order 1 up to order `n` with respect to the
0 commit comments