Skip to content

Commit

Permalink
Merge pull request #141 from oscarbenjamin/pr_roots_doctest
Browse files Browse the repository at this point in the history
fix: make roots doctests compatible with latest Flint
  • Loading branch information
oscarbenjamin authored Jun 13, 2024
2 parents f6481ca + 7423e61 commit 6d942d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/flint/types/acb_poly.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,13 @@ cdef class acb_poly(flint_poly):
The input polynomial must be squarefree and sufficiently
accurate. Raises an exception if unsuccessful.
>>> for c in acb_poly.from_roots([1,2,3,4,5]).roots(1e-10): print(c)
>>> for c in acb_poly.from_roots([1,2,3,4,5]).roots(1e-10): print(float(c.real))
...
[1.00000000000000 +/- 7.71e-18] + [+/- 7.59e-18]j
[2.00000000000000 +/- 1.18e-16] + [+/- 1.16e-16]j
[3.00000000000000 +/- 4.24e-16] + [+/- 4.22e-16]j
[4.00000000000000 +/- 7.21e-16] + [+/- 7.00e-16]j
[5.00000000000000 +/- 2.41e-16] + [+/- 2.24e-16]j
1.0
2.0
3.0
4.0
5.0
>>> for c in acb_poly.from_roots([1,2,2,4,5]).roots(1e-10): print(c)
...
Traceback (most recent call last):
Expand Down
12 changes: 6 additions & 6 deletions src/flint/types/fmpz_poly.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,13 @@ cdef class fmpz_poly(flint_poly):
>>> fmpz_poly([2,0,1]).complex_roots()
[([1.41421356237310 +/- 4.96e-15]j, 1), ([-1.41421356237310 +/- 4.96e-15]j, 1)]
>>> for c, m in (fmpz_poly([2,3,4]) * fmpz_poly([5,6,7,11])**3).complex_roots():
... print((c,m))
... print(f'{float(c.real)} + {float(c.imag)}*j : {m}')
...
([-0.375000000000000 +/- 1.0e-19] + [0.599478940414090 +/- 5.75e-17]j, 1)
([-0.375000000000000 +/- 1.0e-19] + [-0.599478940414090 +/- 5.75e-17]j, 1)
([-0.735284727404843 +/- 4.11e-16], 3)
([0.0494605455206031 +/- 1.33e-17] + [0.784693167647185 +/- 2.85e-16]j, 3)
([0.0494605455206031 +/- 1.33e-17] + [-0.784693167647185 +/- 2.85e-16]j, 3)
-0.375 + 0.5994789404140899*j : 1
-0.375 + -0.5994789404140899*j : 1
-0.7352847274048426 + 0.0*j : 3
0.04946054552060311 + 0.7846931676471847*j : 3
0.04946054552060311 + -0.7846931676471847*j : 3
"""
cdef fmpz_poly_factor_t fac
Expand Down

0 comments on commit 6d942d5

Please sign in to comment.