Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow the warning about root isolation failures in CBF[x] to be turned off #37357

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/sage/rings/complex_arb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
self('nan'), self('nan', 'nan'), self('inf', 'nan')]

def _roots_univariate_polynomial(self, pol, ring, multiplicities,
algorithm, proof=True):
algorithm, proof=True, warn=True):
r"""
Compute the roots of ``pol``.

Expand Down Expand Up @@ -890,8 +890,8 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
try:
sig_on()
while ((isolated < deg or any(acb_rel_accuracy_bits(&roots[i]) < tgtprec
for i in range(deg)))
and prec < maxprec):
for i in range(deg)))
and prec < maxprec):
acb_poly_set_round(rounded_poly, poly._poly, prec)
maxiter = min(max(deg, 32), prec)
if (prec == initial_prec):
Expand All @@ -905,7 +905,7 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
if proof:
raise ValueError("unable to isolate the roots (try using "
"proof=False or increasing the precision)")
else:
elif warn:
warnings.warn("roots may have been lost")

_acb_vec_sort_pretty(roots, deg)
Expand Down
3 changes: 3 additions & 0 deletions src/sage/rings/polynomial/polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8404,6 +8404,9 @@ cdef class Polynomial(CommutativePolynomial):
UserWarning: roots may have been lost...
[[1.00000000000 +/- ...e-12] + [+/- ...e-11]*I,
[1.0000000000 +/- ...e-12] + [+/- ...e-12]*I]
sage: ((x - 1)^2).roots(multiplicities=False, proof=False, warn=False)
[[1.00000000000 +/- ...e-12] + [+/- ...e-11]*I,
[1.0000000000 +/- ...e-12] + [+/- ...e-12]*I]

Note that coefficients in a number field with defining polynomial
`x^2 + 1` are considered to be Gaussian rationals (with the
Expand Down
Loading