Repository navigation
Drop a radical root in back-substitution only where an interval shows it fails - #2521
Merged
Merged
Conversation
… it fails
The Groebner back-substitution puts each root of the last equation into the others and drops a
root that leaves one a nonzero number. A root with a radical in it, or an equation holding one
assigned before, is put to a number by evaluating, and where the terms are large they cancel to
what their hundred digits leave, which downcasting reads as a rational: the root
(-4 10^24 - sqrt(28 10^48)) / 6 of its own quartic, with terms near 1e96, left 13/10000. So the
system for the parts of x in an equation in a modulus with roots near 10^23 or more dropped its
real roots, and 1 - 2x + x|-2 - 3x| = 0 with x written as 10^-24 x was { }. An equation that is
a polynomial over Q at the root is still decided exactly; one that is not is decided by an
interval, and a root it does not show to fail goes on.
Near 10^30 InnerSimplified itself evaluates the radicals into decimals past its digits and
downcasts them to integers, so the narrowed equations are wrong before this check is reached,
and roots are still lost there, as on master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2521 +/- ##
==========================================
+ Coverage 86.89% 86.91% +0.01%
==========================================
Files 340 340
Lines 73970 73992 +22
Branches 21548 21555 +7
==========================================
+ Hits 64277 64310 +33
+ Misses 5222 5212 -10
+ Partials 4471 4470 -1
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 in a modulus is solved as a system in the real and imaginary parts of
x. In Gröbner back-substitution, each root of the last equation is substituted into the others, and a root that leaves any of them a nonzero number is dropped. A root containing a radical is substituted by evaluating, and where the terms are large they cancel to whatever their hundred digits leave, which downcasting reads as a rational. For example, the root(-4·10^24 - sqrt(28·10^48)) / 6, substituted into its own quartic (terms near1e96), left13/10000. So these equations lost their real roots once the roots were near10^23or larger:(1 - 2y) + y abs(-2 - 3y) = 0withy = 10^(-24) x{ }{ }{ -10^24/3 sqrt(7) - 2·10^24/3 }-2y + 3y^2 - 2 abs(-3 + 2y) = 0withy = 10^(-24) x{ }{ }The check now treats an equation as failing at a root in two ways. If the equation, with the root substituted, is still a polynomial over Q, it is decided exactly, as before. If it is not, an interval has to show it isn't 0; when the interval doesn't, the root is kept, and every solution is still checked against the original system at the end.
Not fixed: roots near
10^30are still lost, as on master. At that scaleInnerSimplifiedevaluates the radicals to decimals beyond their hundred digits and downcasts the results to integers whose last digits were never computed (157145…000). So the narrowed equations are already wrong before this check runs. Fixing that would mean downcasting refuses to call a decimal an integer when its precision doesn't reach the units digit. That changes how numbers are created everywhere, so it is left for a separate decision (#1019).Checks:
x = 10^(-30) xdrop from 11 answers differing in their roots on master to 5: the 2 log sums at10^30 x(a separate defect), and 3 near10^30(above).Found by solving generated equations with
xwritten as10^-30 x. No issue was filed.🤖 Generated with Claude Code