Repository navigation
Square an equation in two different square roots away twice - #2335
Merged
Merged
Conversation
m_1 sqrt(A) + m_2 sqrt(B) + P = 0 with two different square roots was not raised at all, and went to Newton's method, which cannot reach a root where a radicand is 0. sqrt(-4 - 4x) + sqrt(2 + x) = -3 - 4x was answered without its root -1. 2.6.0 found that root only because a compiled 0^(-1/2) was 0, so Newton's step from -1 was 0; since #2231 made it NaN, the root has been missed, and sqrt(2x + 3) - sqrt(x + 1) = 1 lost its root -1 with it. It is now squared twice, 4 P^2 m_2^2 B = (m_1^2 A - P^2 - m_2^2 B)^2, which keeps every root, and each root of that polynomial is put back into the equation as for one radical. Only for an equation in x alone: with a parameter left in, a root put back cannot be decided, and sqrt(x + 1) + sqrt(x + 2) + a + x = 0 kept all four roots of its square. radcheck, random radical equations, unsolved on master and here: seed 61, 26 and 5 of 400; seed 51, 31 and 7; seed 22, 24 and 3; seed 62 (pow), 0 and 0 of 600. No root is unsound and none missed but one that is not a root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2335 +/- ##
=======================================
Coverage 86.76% 86.77%
=======================================
Files 312 312
Lines 68526 68540 +14
Branches 19935 19938 +3
=======================================
+ Hits 59458 59473 +15
Misses 4907 4907
+ Partials 4161 4160 -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.
Found by a radical-equation cross-check at a seed not used before. No issue was filed.
m_1 sqrt(A) + m_2 sqrt(B) + P = 0, with two different square roots, was not raised at all. It went to Newton's method, which cannot reach a root where a radicand is 0.sqrt(-4 - 4x) + sqrt(2 + x) = -3 - 4x{ -1.19517…, -1 }{ -1.19517… }{ -1, … }, the other root in radicalssqrt(2x + 3) - sqrt(x + 1) = 1{ -1, 3 }{ 3 }{ -1, 3 }sqrt(-4 - 4x) + sqrt(2 + x) = 1{ -1 }{ -1 }The middle column is a regression since 2.6.0, bisected to #2231. 2.6.0 found these roots only because a compiled
0^(-1/2)was0, so Newton's step from the domain's edge was 0. #2231 made itNaN, which is right, and from then on the root was missed.The equation is now squared twice,
4 P^2 m_2^2 B = (m_1^2 A - P^2 - m_2^2 B)^2. That keeps every root, and each root of the polynomial is put back into the equation, as for one radical. This happens only for an equation in x alone. With a parameter left in, putting a root back cannot be decided:sqrt(x + 1) + sqrt(x + 2) + a + x = 0kept all four roots of its square, and ata = 2none of them is a root.The same parametric problem exists on master, and in 2.6.0, for one radical:
sqrt(x + 1) + a + x = 0is answered with both roots of its square, and for eachaone of them is not a root. That gets its own PR.radcheck (random radical equations against mpmath), unsolved on master and here:
powNo answer is unsound. The one root reported missed, at seed 61, is a harness false positive and is reported against master too:
1 - 1.732iisn't a root ofx·sqrt(x² - 2x + 1) = x - 4.Tests: all eight cases in
TwoSquareRootsTestfail on master. There is a BREAKING entry, An equation in two different square roots is solved exactly.🤖 Generated with Claude Code