Skip to content

Commit 6d942d5

Browse files
Merge pull request #141 from oscarbenjamin/pr_roots_doctest
fix: make roots doctests compatible with latest Flint
2 parents f6481ca + 7423e61 commit 6d942d5

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/flint/types/acb_poly.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,13 @@ cdef class acb_poly(flint_poly):
349349
The input polynomial must be squarefree and sufficiently
350350
accurate. Raises an exception if unsuccessful.
351351
352-
>>> for c in acb_poly.from_roots([1,2,3,4,5]).roots(1e-10): print(c)
352+
>>> for c in acb_poly.from_roots([1,2,3,4,5]).roots(1e-10): print(float(c.real))
353353
...
354-
[1.00000000000000 +/- 7.71e-18] + [+/- 7.59e-18]j
355-
[2.00000000000000 +/- 1.18e-16] + [+/- 1.16e-16]j
356-
[3.00000000000000 +/- 4.24e-16] + [+/- 4.22e-16]j
357-
[4.00000000000000 +/- 7.21e-16] + [+/- 7.00e-16]j
358-
[5.00000000000000 +/- 2.41e-16] + [+/- 2.24e-16]j
354+
1.0
355+
2.0
356+
3.0
357+
4.0
358+
5.0
359359
>>> for c in acb_poly.from_roots([1,2,2,4,5]).roots(1e-10): print(c)
360360
...
361361
Traceback (most recent call last):

src/flint/types/fmpz_poly.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,13 @@ cdef class fmpz_poly(flint_poly):
391391
>>> fmpz_poly([2,0,1]).complex_roots()
392392
[([1.41421356237310 +/- 4.96e-15]j, 1), ([-1.41421356237310 +/- 4.96e-15]j, 1)]
393393
>>> for c, m in (fmpz_poly([2,3,4]) * fmpz_poly([5,6,7,11])**3).complex_roots():
394-
... print((c,m))
394+
... print(f'{float(c.real)} + {float(c.imag)}*j : {m}')
395395
...
396-
([-0.375000000000000 +/- 1.0e-19] + [0.599478940414090 +/- 5.75e-17]j, 1)
397-
([-0.375000000000000 +/- 1.0e-19] + [-0.599478940414090 +/- 5.75e-17]j, 1)
398-
([-0.735284727404843 +/- 4.11e-16], 3)
399-
([0.0494605455206031 +/- 1.33e-17] + [0.784693167647185 +/- 2.85e-16]j, 3)
400-
([0.0494605455206031 +/- 1.33e-17] + [-0.784693167647185 +/- 2.85e-16]j, 3)
396+
-0.375 + 0.5994789404140899*j : 1
397+
-0.375 + -0.5994789404140899*j : 1
398+
-0.7352847274048426 + 0.0*j : 3
399+
0.04946054552060311 + 0.7846931676471847*j : 3
400+
0.04946054552060311 + -0.7846931676471847*j : 3
401401
402402
"""
403403
cdef fmpz_poly_factor_t fac

0 commit comments

Comments
 (0)