@@ -308,7 +308,8 @@ def disc(self):
308
308
sage: Q.matrix().det()
309
309
-50
310
310
"""
311
- return 4 * self ._a * self ._b * self ._c + self ._r * self ._s * self ._t - self ._a * self ._r ** 2 - self ._b * self ._s ** 2 - self ._c * self ._t ** 2
311
+ return (4 * self ._a * self ._b * self ._c + self ._r * self ._s * self ._t
312
+ - self ._a * self ._r ** 2 - self ._b * self ._s ** 2 - self ._c * self ._t ** 2 )
312
313
313
314
def is_definite (self ) -> bool :
314
315
"""
@@ -329,18 +330,12 @@ def is_definite(self) -> bool:
329
330
if d1 == 0 :
330
331
return False
331
332
d2 = 4 * self ._a * self ._b - self ._t ** 2
332
- if d2 = = 0 :
333
+ if d2 < = 0 :
333
334
return False
334
335
d3 = self .disc ()
335
336
if d3 == 0 :
336
337
return False
337
- if d1 > 0 :
338
- if d2 > 0 :
339
- return d3 > 0
340
- return False
341
- if d2 > 0 :
342
- return d3 < 0
343
- return False
338
+ return (d1 > 0 ) == (d3 > 0 )
344
339
345
340
def is_positive_definite (self ) -> bool :
346
341
"""
@@ -366,12 +361,12 @@ def is_positive_definite(self) -> bool:
366
361
if d1 == 0 :
367
362
return False
368
363
d2 = 4 * self ._a * self ._b - self ._t ** 2
369
- if d2 = = 0 :
364
+ if d2 < = 0 :
370
365
return False
371
366
d3 = self .disc ()
372
367
if d3 == 0 :
373
368
return False
374
- return d1 > 0 and d2 > 0 and d3 > 0
369
+ return d1 > 0 and d3 > 0
375
370
376
371
def is_negative_definite (self ) -> bool :
377
372
"""
@@ -1091,11 +1086,13 @@ def automorphism_spin_norm(self, A):
1091
1086
s = self (b1 ) * self (b2 )
1092
1087
return s .squarefree_part ()
1093
1088
1094
- def _border (self , n ):
1089
+ def _border (self , n ) -> bool :
1095
1090
"""
1096
1091
Auxiliary function to find the automorphisms of a positive definite ternary quadratic form.
1097
1092
1098
- It returns a boolean whether the n-condition is true. If Q = TernaryQF([a,b,c,r,s,t]), the conditions are:
1093
+ It returns a boolean whether the n-condition is true.
1094
+
1095
+ If Q = TernaryQF([a,b,c,r,s,t]), the conditions are:
1099
1096
1100
1097
1. a = t, s = 2r.
1101
1098
2. a = s, t = 2r.
0 commit comments