Repository navigation
Decline a modulus piece's root that is not decided real or inside, rather than leave it out (#2659) - #2673
Open
Rafael-SOWNet wants to merge 2 commits into
Open
Decline a modulus piece's root that is not decided real or inside, rather than leave it out (#2659)#2673Rafael-SOWNet wants to merge 2 commits into
Rafael-SOWNet wants to merge 2 commits into
Conversation
…ther than leave it out (#2659) Over the reals ModulusSolver.SolveOverTheReals kept a root of a piece only where its Evaled was a Real inside the piece, and left out every other root as though it were known to be complex or outside. With x written 10^30 x the decimals flushed the parts of the quartic's roots, near 10^-31, and read them as complex numbers near 2.27; all eight were left out and (10^30 x)^4 - 10 (10^30 x)^2 + |10^30 x| + 1 = 0 was answered { }. A root of a piece, and a root of a modulus's argument taken as a kink, is now read without the exponent floor and decided three ways. It is not real where a 40- or 80-digit enclosure of it is off the real line, or, where the interval evaluator finds none (the quartic formula's roots straddle a cut), where its imaginary part is clear of 1e-30 times the largest of the roots it was found with, which is what a formula's rounding is relative to. It is real where it evaluates to a real. Any other root declines the equation. Membership of a piece, the order of two kinks and the sign of a modulus inside a piece are decided exactly for rationals, by enclosures that are apart, as equal where the two are written alike or their difference simplifies to 0, and by decimals beside the roots' size only where no enclosure is found; undecided declines. A rational root the piece's equation is decided not to hold at declines too: the quartic formula gave 0 in place of the root near -10^-150 of x^4 - 10 x^2 + x + 10^-150, and the answer was left without it. A piece with no x is the whole piece only where it is 0, not where it merely failed to evaluate to 0. RootsWhereZero, for the complex numbers, judged an entry's imaginary part beside the entry's own size and a negative modulus beside max(1, |t|), which is absolute below 1. Both are now judged beside the largest entry of the row, so a part near 0 of a root near 1 is not read off the real line by rounding alone, and an entry not decided declines. The issue's equation now has its four real roots, 10^-30 times those of x^4 - 10 x^2 + |x| + 1. CasBench 120/121, RootCheck 596/596, SimpSweep 10463/10463 and BoundCheck 0 disagreements, unchanged from master 97f26c6, with every answer identical. A sweep of 272 generated modulus equations over both codomains changed two answers: the issue's, and 1 - 2 y + y |-2 - 3 y| with y = 10^30 x, the same root written as the unscaled one is. No answer became a decline. #2659 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2673 +/- ##
==========================================
- Coverage 86.73% 86.70% -0.03%
==========================================
Files 346 346
Lines 75913 76014 +101
Branches 22231 22273 +42
==========================================
+ Hits 65841 65911 +70
- Misses 5426 5447 +21
- Partials 4646 4656 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
… no answer (#2659) Reading each entry of a row against the largest entry declined equations over the complex numbers that master answered. With x written 10^-30 x or 10^30 x, the unknowns of a row differ in size by 10^30. A row's off-the-line entry, which was decided against its own size, was no longer decided against the row's, and so equations with no root, such as 1 - 3x - 3 |3 - x| with x scaled, went from { } to unsolved. The e387 cross-check counted 18 new declines at 10^-30 and 7 at 10^30. The argument for the row's scale was rounding under cancellation, and no example of that was found. So RootsWhereZero goes back to master's reading, and the real-line pieces keep theirs. All 58 of the cross-check's equations, at both scales over the complex numbers, now answer as on master. Over 298 generated equations in moduli with x scaled by 10^30 or 10^-30 over the reals, 16 answers change and none becomes a decline. Each new answer is the unscaled equation's real roots, scaled; 13 of the old answers lacked roots, and 3 were the same roots written another way. The BREAKING-CHANGES entry now gives those measurements in place of the complex row it had. UnitTests 21970 passed. CasBench 120/121, RootCheck 596/596, SimpSweep 10463/10463 and BoundCheck 0 disagreements, every answer as on master. #2659 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #2659
What was wrong
Over the reals,
ModulusSolver.SolveOverTheRealskept a root of a piece only where itsEvaledwas aRealinside the piece. Every other root was left out as though it were known to be complex or outside. Withxwritten10^30 x, the decimals flushed the parts of the quartic's roots, which are near10^-31, and read them as complex numbers near2.27. All eight were left out, so(10^30 x)^4 - 10 (10^30 x)^2 + abs(10^30 x) + 1 = 0was answered{ }.The fix
Each root is now read without the exponent floor and decided one of three ways:
PreciseEvaluation) is off the real line. Where the interval evaluator finds no enclosure (the quartic formula's roots straddle a cut), a root is also not real where its imaginary part is clear of1e-30times the largest of the piece's roots, since a formula's rounding is relative to that size and not to the root's own.null).The roots of a modulus's argument (the kinks) go through the same reading. A kink left out is two pieces read as one.
Membership of a piece, the order of two kinks and the sign of a modulus inside a piece are decided by one comparison:
InnerSimplifieds to 0;Undecided declines. In particular, two decimals that agree no longer put a root on the closed end of a piece. A root equal to its kink is written alike.
Two more sites in the same method had the same shape:
0in place of the root near-10^-150ofx^4 - 10 x^2 + x + 10^-150. The outer verification then dropped it, andx^4 - 10 x^2 - |x| + 10^-150lost two of its four roots.RootsWhereZero(complex numbers) is unchanged from master. A first version judged a row's entries against the row's largest entry. Withxscaled by10^30or10^-30, the unknowns of a row differ in size by10^30, and that version declined 18 + 7 equations over the complex numbers which master answered, most of them{ }for equations with no root. It was reverted in the second commit.LogarithmSolverandPolynomialCandidateswere audited. Their realness and positivity drops act only on candidates already shown to leave a polynomial residual of 0, so they were left alone (see the last section).Measured
On this branch (f180ed8) and on master
97f26c663:None of the harnesses changed any answer.
xscaled by10^-30and by10^30, complex codomain) now answer exactly as on master.xwritten10^30 xorx / 10^30. 16 answers changed, and none became a decline. Each new answer equals the unscaled equation's real roots, scaled. 13 of master's answers were missing roots, among them{ }answers, and 3 were the same roots written another way.All of this is in
BREAKING-CHANGES.md.Tests
SolverRegressionTest.Issue2659_*:{ }. If it answers, the roots must be its four real roots, checked without the floor against10^-30times those of the unscaled equation.ModulusSolverdirectly.x^4 - 10 x^2 - abs(x) + 10^-150and+ 10^-70must give eithernullor four real roots, two of them below10^-60.On master, the first two fail and the guards pass.
The tests hold whichever way the evaluation floor is settled (#2668). Once it is lifted the issue's equation may answer directly. The
10^-150case still declines, because its small roots are what terms near 3 cancel to at a hundred digits.Not fixed here (found on the way, master behaviour, floor-related)
ln(x) + ln(x + 1) + 600 = 0,ln(x) + ln(2 x) + 600 = 0andln(x) + 2 ln(x) + 900 = 0answer{ }. The candidates come from a polynomial in whiche^-600flushed to 0.2 x^2 - e^(-600) = 0answers{ 0 }.x^2 - 10^(-300) = 0answers only1/10^150.abs(x - 1) + x^2 - 1 - 10^(-99) = 0answers{ 0, 1 }, which is wrong. It comes from a route other thanModulusSolver, which now declines it.x^4 - 10 x^2 - abs(x) + 10^(-150) = 0still answers two of its four roots, through another route afterModulusSolverdeclines.🤖 Generated with Claude Code