@@ -70,8 +70,8 @@ def __init__(self, A, f):
70
70
Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2
71
71
"""
72
72
super ().__init__ (A , f )
73
- self ._coefficients = [f [(2 ,0 , 0 )], f [(1 ,1 , 0 )], f [(1 ,0 , 1 )],
74
- f [(0 ,2 , 0 )], f [(0 ,1 , 1 )], f [(0 ,0 , 2 )]]
73
+ self ._coefficients = [f [(2 , 0 , 0 )], f [(1 , 1 , 0 )], f [(1 , 0 , 1 )],
74
+ f [(0 , 2 , 0 )], f [(0 , 1 , 1 )], f [(0 , 0 , 2 )]]
75
75
self ._parametrization = None
76
76
self ._diagonal_matrix = None
77
77
@@ -116,13 +116,13 @@ def base_extend(self, S):
116
116
return self
117
117
if not S .has_coerce_map_from (B ):
118
118
raise ValueError ("No natural map from the base ring of self "
119
- "(= %s) to S (= %s)" % (self , S ))
119
+ "(= %s) to S (= %s)" % (self , S ))
120
120
from .constructor import Conic
121
121
con = Conic ([S (c ) for c in self .coefficients ()],
122
122
self .variable_names ())
123
123
if self ._rational_point is not None :
124
124
pt = [S (c ) for c in Sequence (self ._rational_point )]
125
- if not pt == [0 ,0 , 0 ]:
125
+ if not pt == [0 , 0 , 0 ]:
126
126
# The following line stores the point in the cache
127
127
# if (and only if) there is no point in the cache.
128
128
pt = con .point (pt )
@@ -284,26 +284,26 @@ def diagonal_matrix(self):
284
284
"""
285
285
A = self .symmetric_matrix ()
286
286
B = self .base_ring ()
287
- basis = [vector (B ,{2 :0 , i : 1 }) for i in range (3 )]
287
+ basis = [vector (B , {2 : 0 , i : 1 }) for i in range (3 )]
288
288
for i in range (3 ):
289
289
zerovalue = (basis [i ]* A * basis [i ].column () == 0 )
290
290
if zerovalue :
291
- for j in range (i + 1 ,3 ):
291
+ for j in range (i + 1 , 3 ):
292
292
if basis [j ]* A * basis [j ].column () != 0 :
293
293
b = basis [i ]
294
294
basis [i ] = basis [j ]
295
295
basis [j ] = b
296
296
zerovalue = False
297
297
if zerovalue :
298
- for j in range (i + 1 ,3 ):
298
+ for j in range (i + 1 , 3 ):
299
299
if basis [i ]* A * basis [j ].column () != 0 :
300
300
basis [i ] = basis [i ]+ basis [j ]
301
301
zerovalue = False
302
302
if not zerovalue :
303
303
l = (basis [i ]* A * basis [i ].column ())
304
- for j in range (i + 1 ,3 ):
304
+ for j in range (i + 1 , 3 ):
305
305
basis [j ] = basis [j ] - \
306
- (basis [i ]* A * basis [j ].column ())/ l * basis [i ]
306
+ (basis [i ]* A * basis [j ].column ())/ l * basis [i ]
307
307
T = matrix (basis ).transpose ()
308
308
return T .transpose ()* A * T , T
309
309
@@ -537,24 +537,24 @@ def has_rational_point(self, point=False,
537
537
538
538
if isinstance (B , sage .rings .abc .ComplexField ):
539
539
if point :
540
- [ _ , _ , _ , d , e , f ] = self ._coefficients
540
+ _ , _ , _ , d , e , f = self ._coefficients
541
541
if d == 0 :
542
- return True , self .point ([0 ,1 , 0 ])
542
+ return True , self .point ([0 , 1 , 0 ])
543
543
return True , self .point ([0 , ((e ** 2 - 4 * d * f ).sqrt ()- e )/ (2 * d ), 1 ],
544
544
check = False )
545
545
return True
546
546
if isinstance (B , sage .rings .abc .RealField ):
547
547
D , T = self .diagonal_matrix ()
548
- [ a , b , c ] = [D [0 ,0 ], D [1 ,1 ], D [2 ,2 ]]
548
+ a , b , c = [D [0 , 0 ], D [1 , 1 ], D [2 , 2 ]]
549
549
if a == 0 :
550
- ret = True , self .point (T * vector ([1 ,0 , 0 ]), check = False )
550
+ ret = True , self .point (T * vector ([1 , 0 , 0 ]), check = False )
551
551
elif a * c <= 0 :
552
- ret = True , self .point (T * vector ([(- c / a ).sqrt (),0 , 1 ]),
552
+ ret = True , self .point (T * vector ([(- c / a ).sqrt (), 0 , 1 ]),
553
553
check = False )
554
554
elif b == 0 :
555
- ret = True , self .point (T * vector ([0 ,1 , 0 ]), check = False )
555
+ ret = True , self .point (T * vector ([0 , 1 , 0 ]), check = False )
556
556
elif b * c <= 0 :
557
- ret = True , self .point (T * vector ([0 ,(- c / b ).sqrt (),0 , 1 ]),
557
+ ret = True , self .point (T * vector ([0 , (- c / b ).sqrt (), 0 , 1 ]),
558
558
check = False )
559
559
else :
560
560
ret = False , None
@@ -617,16 +617,16 @@ def has_singular_point(self, point=False):
617
617
return ret [0 ]
618
618
B = self .base_ring ()
619
619
if B .characteristic () == 2 :
620
- [ a , b , c , d , e , f ] = self .coefficients ()
620
+ a , b , c , d , e , f = self .coefficients ()
621
621
if b == 0 and c == 0 and e == 0 :
622
622
for i in range (3 ):
623
623
if [a , d , f ][i ] == 0 :
624
- return True , self .point (vector (B , {2 :0 , i :1 }))
624
+ return True , self .point (vector (B , {2 : 0 , i : 1 }))
625
625
if hasattr (a / f , 'is_square' ) and hasattr (a / f , 'sqrt' ):
626
626
if (a / f ).is_square ():
627
- return True , self .point ([1 ,0 , (a / f ).sqrt ()])
627
+ return True , self .point ([1 , 0 , (a / f ).sqrt ()])
628
628
if (d / f ).is_square ():
629
- return True , self .point ([0 ,1 , (d / f ).sqrt ()])
629
+ return True , self .point ([0 , 1 , (d / f ).sqrt ()])
630
630
raise NotImplementedError ("Sorry, find singular point on conics not implemented over all fields of characteristic 2." )
631
631
pt = [e , c , b ]
632
632
if self .defining_polynomial ()(pt ) == 0 :
@@ -760,7 +760,7 @@ def is_smooth(self):
760
760
True
761
761
"""
762
762
if self .base_ring ().characteristic () == 2 :
763
- [ a , b , c , d , e , f ] = self .coefficients ()
763
+ a , b , c , d , e , f = self .coefficients ()
764
764
if b == 0 and c == 0 and e == 0 :
765
765
return False
766
766
return self .defining_polynomial ()([e , c , b ]) != 0
@@ -803,7 +803,7 @@ def _magma_init_(self, magma):
803
803
kmn = magma (self .base_ring ())._ref ()
804
804
coeffs = self .coefficients ()
805
805
magma_coeffs = [coeffs [i ]._magma_init_ (magma ) for i in [0 , 3 , 5 , 1 , 4 , 2 ]]
806
- return 'Conic([%s|%s])' % (kmn ,',' .join (magma_coeffs ))
806
+ return 'Conic([%s|%s])' % (kmn , ',' .join (magma_coeffs ))
807
807
808
808
def matrix (self ):
809
809
r"""
@@ -1265,10 +1265,10 @@ def upper_triangular_matrix(self):
1265
1265
x^2 + 2*x*y + y^2 + 3*x*z + z^2
1266
1266
"""
1267
1267
from sage .matrix .constructor import matrix
1268
- [ a , b , c , d , e , f ] = self .coefficients ()
1269
- return matrix ([[ a , b , c ],
1270
- [ 0 , d , e ],
1271
- [ 0 , 0 , f ]])
1268
+ a , b , c , d , e , f = self .coefficients ()
1269
+ return matrix ([[a , b , c ],
1270
+ [0 , d , e ],
1271
+ [0 , 0 , f ]])
1272
1272
1273
1273
def variable_names (self ):
1274
1274
r"""
0 commit comments