Repository navigation
A radical of a constant is a coefficient, and a polynomial with real coefficients has all its roots - #2326
Merged
Conversation
…l with real coefficients by Durand-Kerner FractionedPolynoms raises an equation to a power to remove a radical, and it took every power with a fractional exponent for one, sqrt(2) among them. Raising x^5 + x - sqrt(2) = 0 gives (x^5 + x)^2 = 2, whose substitution gives back x^5 + x = sqrt(2), so the solver recursed until the stack ran out. Since a whole power times a radical is read as one, the same loop is reached from sqrt(y) - x = sqrt(2) - 1, |x| + y = 3 with y eliminated. Only a power whose base contains x is a radical to raise now. Such a polynomial then went to Newton's method, which starts inside a bounded region and misses a root outside it. DurandKerner.RootsOf reads a polynomial whose coefficients are real constants and runs the iteration on their values. They are known to the working precision only, so a root of multiplicity m splits by about the m-th root of that error; approximations closer than 10^(-digits / (2n)) are taken not to be separated, and it answers nothing. Generated polynomials of degree 5 to 8 with one coefficient times sqrt(2) or sqrt(3), 200 at seed 7 against mpmath: 2.6.0 timed out on 95, missed 67 roots and answered 12 non-roots; master timed out on 154 and answered 6 non-roots; this has no findings, nor at seeds 8 and 9. Integer polynomials at seeds 5 and 6, the radical cross-check at seeds 21, 31 and 41, and 1190 generated systems are as on master, except that two systems that timed out are unsolved. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An equation with a radical of a constant among its coefficients could end the process with a stack overflow, and a polynomial with one missed its far roots.
The overflow.
FractionedPolynomsraises an equation to a power to remove a radical, and it took any power with a fractional exponent for one,sqrt(2)among them. Raisingx^5 + x - sqrt(2) = 0gives(x^5 + x)^2 = 2, and the substitution that solves that gives backx^5 + x = sqrt(2), the equation it started from, so the solver recursed until the stack ran out. 2.6.0 and master both crash on it. Since #2323, which reads a whole power times a radical, the same loop is reached fromsqrt(y) - x = sqrt(2) - 1, |x| + y = 3withyeliminated, which is where a check of generated systems found it. Only a power whose base containsxis now a radical to raise; a radical of a constant is a coefficient.The far roots. With the radical a coefficient, such a polynomial goes on to the numerical routes. #2324 answers a polynomial with rational coefficients by the Durand–Kerner iteration, all roots or none, and anything else went to Newton's method, which starts inside a bounded region and misses a root outside it.
DurandKerner.RootsOfnow reads a polynomial whose coefficients are real constants,sqrt(2)orpi, and runs the same iteration on their values. Those values are known to the working precision rather than exactly, so a repeated root cannot be told from a cluster. A root of multiplicitymsplits by about them-th root of that error, so approximations closer than10^(-digits / (2n))for degreenare taken not to be separated, and it answers nothing then. A coefficient smaller than the largest by more than half the digits may be an unsimplified zero, so it answers nothing for that too.Generated polynomials of degree 5 to 8, one coefficient times
sqrt(2)orsqrt(3), checked against mpmath'spolyroots, 30 s per polynomial:At seeds 8 and 9 this branch has no findings either. The same check without the radical, at seeds 5 and 6, has none, the same as master.
Against master, everything else is unchanged:
xmode, 1000 at seed 41The two systems that time out on master are the ones above,
sqrt(y) - x = sqrt(2) - 1, |x| + y = 3and itssqrt(-2)twin. They are now unsolved, as they were on master before #2323.BREAKING-CHANGES.mdhas an entry. Tests, inARadicalTimesAPowerTest:ARadicalOfAConstantIsNotRaisedAPolynomialWithARadicalCoefficientIsAnsweredAPolynomialWithRealCoefficientsHasAllItsRootsASystemThatEliminatesToOneFinishesEach fails on master.
APolynomialWithRealCoefficientsHasAllItsRootsalso fails with the overflow fix alone.🤖 Generated with Claude Code