@@ -438,11 +438,17 @@ def test_fmpz_poly():
438
438
assert Z ([1 ,2 ,2 ]).sqrt () is None
439
439
assert Z ([1 ,0 ,2 ,0 ,3 ]).deflation () == (Z ([1 ,2 ,3 ]), 2 )
440
440
assert Z ([1 ,1 ]).deflation () == (Z ([1 ,1 ]), 1 )
441
- [(r ,m )] = Z ([1 ,1 ]).roots ()
441
+ [(r ,m )] = Z ([1 ,1 ]).complex_roots ()
442
442
assert m == 1
443
443
assert r .overlaps (- 1 )
444
+ assert Z ([]).complex_roots () == []
445
+ assert Z ([1 ]).complex_roots () == []
446
+ [(r ,m )] = Z ([1 ,1 ]).roots ()
447
+ assert m == 1
448
+ assert r == - 1
444
449
assert Z ([]).roots () == []
445
450
assert Z ([1 ]).roots () == []
451
+ assert Z ([1 , 2 ]).roots () == []
446
452
447
453
def test_fmpz_poly_factor ():
448
454
Z = flint .fmpz_poly
@@ -985,11 +991,13 @@ def set_bad():
985
991
assert Q .bernoulli_poly (3 ) == Q ([0 ,1 ,- 3 ,2 ],2 )
986
992
assert Q .euler_poly (3 ) == Q ([1 ,0 ,- 6 ,4 ],4 )
987
993
assert Q .legendre_p (3 ) == Q ([0 ,- 3 ,0 ,5 ],2 )
988
- assert Q ([]).roots () == []
989
- assert Q ([1 ]).roots () == []
990
- [(r ,m )] = Q ([1 ,1 ]).roots ()
994
+ assert Q ([]).complex_roots () == []
995
+ assert Q ([1 ]).complex_roots () == []
996
+ [(r ,m )] = Q ([1 ,1 ]).complex_roots ()
991
997
assert m == 1
992
998
assert r .overlaps (- 1 )
999
+ assert str (Q ([1 ,2 ]).roots ()) == "[(-1/2, 1)]"
1000
+ assert Q ([2 ,1 ]).roots () == [(- 2 , 1 )]
993
1001
994
1002
def test_fmpq_mat ():
995
1003
Q = flint .fmpq_mat
@@ -1411,6 +1419,9 @@ def set_bad2():
1411
1419
for alg in [None , 'berlekamp' , 'cantor-zassenhaus' ]:
1412
1420
assert p3 .factor (alg ) == f3
1413
1421
assert p3 .factor (algorithm = alg ) == f3
1422
+ assert P ([1 ], 11 ).roots () == []
1423
+ assert P ([1 , 2 , 3 ], 11 ).roots () == [(8 , 1 ), (6 , 1 )]
1424
+ assert P ([1 , 6 , 1 , 8 ], 11 ).roots () == [(5 , 3 )]
1414
1425
1415
1426
def test_nmod_mat ():
1416
1427
M = flint .nmod_mat
0 commit comments