@@ -418,10 +418,11 @@ def monic_integral_model(self, names=None):
418
418
raise ValueError ("names must contain at most 2 entries" )
419
419
420
420
if self .base_field () is not self .rational_function_field ():
421
- L ,from_L ,to_L = self .simple_model ()
422
- ret ,ret_to_L ,L_to_ret = L .monic_integral_model (names )
423
- from_ret = ret .hom ( [from_L (ret_to_L (ret .gen ())), from_L (ret_to_L (ret .base_field ().gen ()))] )
424
- to_ret = self .hom ( [L_to_ret (to_L (k .gen ())) for k in self ._intermediate_fields (self .rational_function_field ())] )
421
+ L , from_L , to_L = self .simple_model ()
422
+ ret , ret_to_L , L_to_ret = L .monic_integral_model (names )
423
+ from_ret = ret .hom ([from_L (ret_to_L (ret .gen ())),
424
+ from_L (ret_to_L (ret .base_field ().gen ()))])
425
+ to_ret = self .hom ([L_to_ret (to_L (k .gen ())) for k in self ._intermediate_fields (self .rational_function_field ())])
425
426
return ret , from_ret , to_ret
426
427
else :
427
428
if self .polynomial ().is_monic () and all (c .denominator ().is_one () for c in self .polynomial ()):
@@ -431,12 +432,12 @@ def monic_integral_model(self, names=None):
431
432
return self .change_variable_name (names )
432
433
else :
433
434
if not names :
434
- names = (self .variable_name ()+ "_" ,)
435
+ names = (self .variable_name () + "_" ,)
435
436
if len (names ) == 1 :
436
437
names = (names [0 ], self .rational_function_field ().variable_name ())
437
438
438
439
g , d = self ._make_monic_integral (self .polynomial ())
439
- K ,from_K ,to_K = self .base_field ().change_variable_name (names [1 ])
440
+ K , from_K , to_K = self .base_field ().change_variable_name (names [1 ])
440
441
g = g .map_coefficients (to_K )
441
442
ret = K .extension (g , names = names [0 ])
442
443
from_ret = ret .hom ([self .gen () * d , self .base_field ().gen ()])
@@ -791,7 +792,7 @@ def free_module(self, base=None, basis=None, map=True):
791
792
if not map :
792
793
return V
793
794
from_V = MapVectorSpaceToFunctionField (V , self )
794
- to_V = MapFunctionFieldToVectorSpace (self , V )
795
+ to_V = MapFunctionFieldToVectorSpace (self , V )
795
796
return (V , from_V , to_V )
796
797
797
798
def maximal_order (self ):
@@ -982,7 +983,7 @@ def hom(self, im_gens, base_morphism=None):
982
983
yy |--> y
983
984
984
985
"""
985
- if not isinstance (im_gens , (list ,tuple )):
986
+ if not isinstance (im_gens , (list , tuple )):
986
987
im_gens = [im_gens ]
987
988
if len (im_gens ) == 0 :
988
989
raise ValueError ("no images specified" )
@@ -1025,11 +1026,11 @@ def genus(self):
1025
1026
# making the auxiliary ring which only has polynomials
1026
1027
# with integral coefficients.
1027
1028
tmpAuxRing = PolynomialRing (self ._base_field .constant_field (),
1028
- str (self ._base_field .gen ())+ ',' + str (self ._ring .gen ()))
1029
+ str (self ._base_field .gen ()) + ',' + str (self ._ring .gen ()))
1029
1030
intMinPoly , d = self ._make_monic_integral (self ._polynomial )
1030
1031
curveIdeal = tmpAuxRing .ideal (intMinPoly )
1031
1032
1032
- singular .lib ('normal.lib' ) # loading genus method in Singular
1033
+ singular .lib ('normal.lib' ) # loading genus method in Singular
1033
1034
return int (curveIdeal ._singular_ ().genus ())
1034
1035
1035
1036
else :
@@ -1170,7 +1171,7 @@ def _simple_model(self, name='v'):
1170
1171
B = MS (B )
1171
1172
M_b = V_to_N (B .solve_left (M_to_V (b )))
1172
1173
M_a = V_to_N (B .solve_left (M_to_V (a )))
1173
- M_to_N = M .hom ([M_a ,M_b ])
1174
+ M_to_N = M .hom ([M_a , M_b ])
1174
1175
1175
1176
return N , N_to_M , M_to_N
1176
1177
@@ -1285,7 +1286,7 @@ def simple_model(self, name=None):
1285
1286
if isinstance (self .base_field (), RationalFunctionField ):
1286
1287
# the extension is simple already
1287
1288
if name == self .variable_name ():
1288
- id = Hom (self ,self ).identity ()
1289
+ id = Hom (self , self ).identity ()
1289
1290
return self , id , id
1290
1291
else :
1291
1292
ret = self .base_field ().extension (self .polynomial (), names = (name ,))
@@ -1299,8 +1300,8 @@ def simple_model(self, name=None):
1299
1300
self_ = base_ .extension (self .polynomial ().map_coefficients (to_base_ ), names = (name ,))
1300
1301
gens_in_base_ = [to_base_ (k .gen ())
1301
1302
for k in base ._intermediate_fields (base .rational_function_field ())]
1302
- to_self_ = self .hom ([self_ .gen ()]+ gens_in_base_ )
1303
- from_self_ = self_ .hom ([self .gen (),from_base_ (base_ .gen ())])
1303
+ to_self_ = self .hom ([self_ .gen ()] + gens_in_base_ )
1304
+ from_self_ = self_ .hom ([self .gen (), from_base_ (base_ .gen ())])
1304
1305
1305
1306
# now collapse self_/base_/K(x)
1306
1307
ret , ret_to_self_ , self__to_ret = self_ ._simple_model (name )
@@ -1549,20 +1550,20 @@ def separable_model(self, names=None):
1549
1550
from sage .rings .polynomial .polynomial_ring_constructor import PolynomialRing
1550
1551
R = PolynomialRing (self .constant_base_field (), names = names )
1551
1552
S = R .remove_var (names [1 ])
1552
- f = R ( L .polynomial ().change_variable_name (names [1 ]).map_coefficients (
1553
- lambda c :c .numerator ().change_variable_name (names [0 ]), S ))
1553
+ f = R (L .polynomial ().change_variable_name (names [1 ]).map_coefficients (
1554
+ lambda c : c .numerator ().change_variable_name (names [0 ]), S ))
1554
1555
f = f .polynomial (R .gen (0 )).change_ring (K )
1555
1556
f /= f .leading_coefficient ()
1556
1557
# f must be separable in the other variable (otherwise it would factor)
1557
1558
assert f .gcd (f .derivative ()).is_one ()
1558
1559
1559
1560
ret = K .extension (f , names = (names [0 ],))
1560
1561
# isomorphisms between L and ret are given by swapping generators
1561
- ret_to_L = ret .hom ( [L (L .base_field ().gen ()), L .gen ()] )
1562
- L_to_ret = L .hom ( [ret (K .gen ()), ret .gen ()] )
1562
+ ret_to_L = ret .hom ([L (L .base_field ().gen ()), L .gen ()])
1563
+ L_to_ret = L .hom ([ret (K .gen ()), ret .gen ()])
1563
1564
# compose with from_L and to_L to get the desired isomorphisms between self and ret
1564
- f = ret .hom ( [from_L (ret_to_L (ret .gen ())), from_L (ret_to_L (ret .base_field ().gen ()))] )
1565
- t = self .hom ( [L_to_ret (to_L (self .gen ())), L_to_ret (to_L (self .base_field ().gen ()))] )
1565
+ f = ret .hom ([from_L (ret_to_L (ret .gen ())), from_L (ret_to_L (ret .base_field ().gen ()))])
1566
+ t = self .hom ([L_to_ret (to_L (self .gen ())), L_to_ret (to_L (self .base_field ().gen ()))])
1566
1567
return ret , f , t
1567
1568
1568
1569
def change_variable_name (self , name ):
@@ -1637,13 +1638,13 @@ def change_variable_name(self, name):
1637
1638
raise ValueError ("name must contain at least one string" )
1638
1639
elif len (name ) == 1 :
1639
1640
base = self .base_field ()
1640
- from_base = to_base = Hom (base ,base ).identity ()
1641
+ from_base = to_base = Hom (base , base ).identity ()
1641
1642
else :
1642
1643
base , from_base , to_base = self .base_field ().change_variable_name (name [1 :])
1643
1644
1644
1645
ret = base .extension (self .polynomial ().map_coefficients (to_base ), names = (name [0 ],))
1645
- f = ret .hom ( [k .gen () for k in self ._intermediate_fields (self .rational_function_field ())] )
1646
- t = self .hom ( [k .gen () for k in ret ._intermediate_fields (ret .rational_function_field ())] )
1646
+ f = ret .hom ([k .gen () for k in self ._intermediate_fields (self .rational_function_field ())])
1647
+ t = self .hom ([k .gen () for k in ret ._intermediate_fields (ret .rational_function_field ())])
1647
1648
return ret , f , t
1648
1649
1649
1650
@@ -1701,16 +1702,16 @@ def _inversion_isomorphism(self):
1701
1702
x |--> x)
1702
1703
"""
1703
1704
K = self .base_field ()
1704
- R = PolynomialRing (K ,'T' )
1705
+ R = PolynomialRing (K , 'T' )
1705
1706
x = K .gen ()
1706
1707
xinv = 1 / x
1707
1708
1708
1709
h = K .hom (xinv )
1709
1710
F_poly = R ([h (c ) for c in self .polynomial ().list ()])
1710
1711
F = K .extension (F_poly )
1711
1712
1712
- self2F = self .hom ([F .gen (),xinv ])
1713
- F2self = F .hom ([self .gen (),xinv ])
1713
+ self2F = self .hom ([F .gen (), xinv ])
1714
+ F2self = F .hom ([self .gen (), xinv ])
1714
1715
1715
1716
M , M2F , F2M = F .monic_integral_model ('s' )
1716
1717
@@ -1844,7 +1845,7 @@ def genus(self):
1844
1845
The genus is computed by the Hurwitz genus formula.
1845
1846
"""
1846
1847
k , _ = self .exact_constant_field ()
1847
- different_degree = self .different ().degree () # must be even
1848
+ different_degree = self .different ().degree () # must be even
1848
1849
return Integer (different_degree // 2 - self .degree () / k .degree ()) + 1
1849
1850
1850
1851
def residue_field (self , place , name = None ):
@@ -2123,7 +2124,7 @@ def _places_finite(self, degree):
2123
2124
2124
2125
for d in degree .divisors ():
2125
2126
for p in K ._places_finite (degree = d ):
2126
- for prime ,_ , _ in O .decomposition (p .prime_ideal ()):
2127
+ for prime , _ , _ in O .decomposition (p .prime_ideal ()):
2127
2128
place = prime .place ()
2128
2129
if place .degree () == degree :
2129
2130
yield place
@@ -2167,7 +2168,7 @@ def _places_infinite(self, degree):
2167
2168
<generator object ...>
2168
2169
"""
2169
2170
Oinf = self .maximal_order_infinite ()
2170
- for prime ,_ , _ in Oinf .decomposition ():
2171
+ for prime , _ , _ in Oinf .decomposition ():
2171
2172
place = prime .place ()
2172
2173
if place .degree () == degree :
2173
2174
yield place
@@ -2312,7 +2313,7 @@ def number_of_rational_places(self, r=1):
2312
2313
L = self .L_polynomial ()
2313
2314
Lp = L .derivative ()
2314
2315
2315
- R = IntegerRing ()[[L .parent ().gen ()]] # power series ring
2316
+ R = IntegerRing ()[[L .parent ().gen ()]] # power series ring
2316
2317
2317
2318
f = R (Lp / L , prec = r )
2318
2319
n = f [r - 1 ] + q ** r + 1
@@ -2408,13 +2409,13 @@ def _maximal_order_basis(self):
2408
2409
from .hermite_form_polynomial import reversed_hermite_form
2409
2410
2410
2411
k = self .constant_base_field ()
2411
- K = self .base_field () # rational function field
2412
+ K = self .base_field () # rational function field
2412
2413
n = self .degree ()
2413
2414
2414
2415
# Construct the defining polynomial of the function field as a
2415
2416
# two-variate polynomial g in the ring k[y,x] where k is the constant
2416
2417
# base field.
2417
- S ,(y ,x ) = PolynomialRing (k , names = 'y,x' , order = 'lex' ).objgens ()
2418
+ S , (y , x ) = PolynomialRing (k , names = 'y,x' , order = 'lex' ).objgens ()
2418
2419
v = self .polynomial ().list ()
2419
2420
g = sum ([v [i ].numerator ().subs (x ) * y ** i for i in range (len (v ))])
2420
2421
@@ -2431,15 +2432,15 @@ def _maximal_order_basis(self):
2431
2432
gflat = R .zero ()
2432
2433
for m in g .monomials ():
2433
2434
c = g .monomial_coefficient (m ).polynomial ('zz' )
2434
- gflat += R (c ) * R (m ) # R(m) is a monomial in yy and xx
2435
+ gflat += R (c ) * R (m ) # R(m) is a monomial in yy and xx
2435
2436
2436
2437
k_poly = R (k .polynomial ('zz' ))
2437
2438
2438
2439
# invoke Singular
2439
2440
pols_in_R = normalize (R .ideal ([k_poly , gflat ]))
2440
2441
2441
2442
# reconstruct polynomials in S
2442
- h = R .hom ([y ,x , k .gen ()],S )
2443
+ h = R .hom ([y , x , k .gen ()], S )
2443
2444
pols_in_S = [h (f ) for f in pols_in_R ]
2444
2445
else :
2445
2446
# Call Singular. Singular's "normal" function returns a basis
0 commit comments