151
151
152
152
"""
153
153
154
-
155
154
#*****************************************************************************
156
155
# Copyright (C) 2010 Niles Johnson <[email protected] >
157
156
#
164
163
from sage .rings .polynomial .all import is_PolynomialRing
165
164
from sage .rings .power_series_ring import is_PowerSeriesRing
166
165
167
- from sage .rings .all import ZZ
168
166
from sage .rings .integer import Integer
169
167
from sage .rings .finite_rings .integer_mod_ring import Zmod
170
168
@@ -392,7 +390,8 @@ def __init__(self, parent, x=0, prec=infinity, is_gen=False, check=False):
392
390
#self._value = x
393
391
self ._bg_value = parent ._send_to_bg (x ).add_bigoh (prec )
394
392
except (TypeError , AttributeError ):
395
- raise TypeError ("Input does not coerce to any of the expected rings." )
393
+ raise TypeError ("Input does not coerce to any of the "
394
+ "expected rings." )
396
395
397
396
self ._go_to_fg = parent ._send_to_fg
398
397
self ._prec = self ._bg_value .prec ()
@@ -789,6 +788,8 @@ def trailing_monomial(self):
789
788
"""
790
789
Return the trailing monomial of ``self``
791
790
791
+ This is defined here as the lowest term of the underlying polynomial.
792
+
792
793
EXAMPLE::
793
794
794
795
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
@@ -809,7 +810,7 @@ def trailing_monomial(self):
809
810
810
811
def quo_rem (self , other ):
811
812
r"""
812
- Quotient and remainder for increassing power division
813
+ Quotient and remainder for increasing power division
813
814
814
815
INPUT: ``other`` - an element of the same power series ring as ``self``
815
816
@@ -851,11 +852,10 @@ def quo_rem(self, other):
851
852
ZeroDivisionError
852
853
"""
853
854
if other .parent () is not self .parent ():
854
- raise ValueError , "Don't know how to divide by a element of %s"% (other .parent ())
855
+ raise ValueError ( "Do not know how to divide by a element of %s" % (other .parent () ))
855
856
other_tt = other .trailing_monomial ()
856
857
if not other_tt :
857
858
raise ZeroDivisionError ()
858
- mprec = min (self .prec (), other .prec ())
859
859
rem = self .parent ().zero ().add_bigoh (self .prec ())
860
860
quo = self .parent ().zero ().add_bigoh (self .prec ()- other .valuation ())
861
861
while self :
@@ -900,7 +900,7 @@ def _div_(self, denom_r):
900
900
sage: f/(a*f)
901
901
Traceback (most recent call last):
902
902
...
903
- ValueError: Not divisible
903
+ ValueError: not divisible
904
904
905
905
An example where one looses precision::
906
906
@@ -918,7 +918,7 @@ def _div_(self, denom_r):
918
918
return self * ~ denom_r
919
919
quo , rem = self .quo_rem (denom_r )
920
920
if rem :
921
- raise ValueError ("Not divisible" )
921
+ raise ValueError ("not divisible" )
922
922
else :
923
923
return quo
924
924
@@ -981,8 +981,6 @@ def __mod__(self, other):
981
981
return self .change_ring (Zmod (other ))
982
982
raise NotImplementedError ("Mod on multivariate power series ring elements not defined except modulo an integer." )
983
983
984
-
985
-
986
984
def dict (self ):
987
985
"""
988
986
Return underlying dictionary with keys the exponents and values the
@@ -1216,7 +1214,6 @@ def add_bigoh(self, prec):
1216
1214
"""
1217
1215
return self .parent (self ._bg_value .add_bigoh (prec ))
1218
1216
1219
-
1220
1217
def O (self , prec ):
1221
1218
"""
1222
1219
Return a multivariate power series of total precision obtained
@@ -1341,7 +1338,6 @@ def is_nilpotent(self):
1341
1338
else :
1342
1339
return False
1343
1340
1344
-
1345
1341
def degree (self ):
1346
1342
"""
1347
1343
Return degree of underlying polynomial of ``self``.
@@ -1485,7 +1481,7 @@ def integral(self, *args):
1485
1481
If the base ring is not a field (e.g. `ZZ`), or if it has a non
1486
1482
zero characteristic, (e.g. `ZZ/3ZZ`), integration is not always
1487
1483
possible, while staying with the same base ring. In the first
1488
- case, Sage will report that it hasn't been able to coerce some
1484
+ case, Sage will report that it has not been able to coerce some
1489
1485
coefficient to the base ring::
1490
1486
1491
1487
sage: T.<a,b> = PowerSeriesRing(ZZ,2)
@@ -1564,15 +1560,16 @@ def _integral(self, xx):
1564
1560
R = P .base_ring ()
1565
1561
xx = P (xx )
1566
1562
if not xx .is_gen ():
1567
- for g in P .gens (): # try to find a generator equal to xx
1563
+ for g in P .gens (): # try to find a generator equal to xx
1568
1564
if g == xx :
1569
1565
xx = g
1570
1566
break
1571
1567
else :
1572
- raise ValueError , "%s is not a variable" % ( xx )
1568
+ raise ValueError ( "%s is not a variable" % xx )
1573
1569
xxe = xx .exponents ()[0 ]
1574
- pos = [i for i , c in enumerate (xxe ) if c != 0 ][0 ] # get the position of the variable
1575
- res = { mon .eadd (xxe ) : R (co / (mon [pos ]+ 1 )) for mon , co in self .dict ().iteritems () }
1570
+ pos = [i for i , c in enumerate (xxe ) if c != 0 ][0 ] # get the position of the variable
1571
+ res = {mon .eadd (xxe ): R (co / (mon [pos ]+ 1 ))
1572
+ for mon , co in self .dict ().iteritems ()}
1576
1573
return P ( res ).add_bigoh (self .prec ()+ 1 )
1577
1574
1578
1575
def ogf (self ):
@@ -1749,7 +1746,7 @@ def exp(self, prec=infinity):
1749
1746
OUTPUT:
1750
1747
1751
1748
The exponentiated multivariate power series as a new
1752
- multivaritate power series.
1749
+ multivariate power series.
1753
1750
1754
1751
EXAMPLES::
1755
1752
@@ -1840,7 +1837,7 @@ def log(self, prec=infinity):
1840
1837
OUTPUT:
1841
1838
1842
1839
The logarithm of the multivariate power series as a new
1843
- multivaritate power series.
1840
+ multivariate power series.
1844
1841
1845
1842
EXAMPLES::
1846
1843
@@ -1986,5 +1983,3 @@ def __pow__(self, prec):
1986
1983
if self ._vars != parent .gens ():
1987
1984
raise NotImplementedError
1988
1985
return self ._vars [0 ].parent ()(0 ,prec )
1989
-
1990
-
0 commit comments