Skip to content

Halve a sign change down to the root before Newton's method polishes it - #2331

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-sign-change-is-bisected-before-newton-polishes-it
Nov 2, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-sign-change-is-bisected-before-newton-polishes-it

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Found by a radical-equation cross-check at a seed not used before. No issue was filed.

(x^2 - 3x - 3)^(1/3) + sqrt(3x - 4) = 3 has one real root, 3.7961670056822382, checked with mpmath at 40 digits. Solve answered only the complex pair 1.3099 ± 2.3063i. Over the reals it answered { }, which claims there is no root. 2.6.0 answered the same.

The equation goes to Newton's method, which also starts from each bracket where the expression changes sign along the real line. It started from the bracket's midpoint, here 3.7. The root lies just past the cube root's zero at 3.79129, where the slope is unbounded, and from 3.7 the iteration left the real line.

The bracket is now halved down to the root in double precision before Newton polishes it. A pole between the two ends is halved down to as well, and its value rejects it as before, so 1/x = 0 is still { }.

master this PR
radcheck, seed 51 (400 equations) 1 missed root 0
radcheck, seed 22 (400) 376 answered, 24 declined the same
radcheck, seed 53, pow (600) clean clean

Tests: both tests in ARootPastARadicandsZeroTest fail on master. There is a BREAKING entry, A real root just past where a radical's argument changes sign is found.

🤖 Generated with Claude Code

Newton's method, which Solve falls back to, also starts from each bracket
where the expression changes sign along the real line, and it started
from the bracket's midpoint. (x^2 - 3x - 3)^(1/3) + sqrt(3x - 4) = 3 has
its one real root at 3.79617, just past the cube root's zero at 3.79129,
where the slope is unbounded. From the midpoint 3.7 the iteration left the
real line, the root was never answered, and over the reals the answer was
{ }, which claims there is none.

The bracket is now halved down to the root in double precision, and Newton
starts from there. A pole between the two ends is halved down to as well,
and its value rejects it as before: 1/x = 0 is still { }.

radcheck, 400 random radical equations at seed 51: 1 missed root on
master, 0 here; seeds 22 and 53 (pow) are the same on both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 2, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 2, 2026
@codecov

codecov Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.76%. Comparing base (93a52f0) to head (d512e44).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2331      +/-   ##
==========================================
+ Coverage   86.75%   86.76%   +0.01%     
==========================================
  Files         312      312              
  Lines       68447    68457      +10     
  Branches    19909    19913       +4     
==========================================
+ Hits        59379    59396      +17     
+ Misses       4908     4903       -5     
+ Partials     4160     4158       -2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.30% <100.00%> (+0.01%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ontinuous/Solvers/NumericalSolving/NewtonSolver.cs 95.96% <100.00%> (+0.35%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit 9e687f0 into master Nov 2, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 2, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-sign-change-is-bisected-before-newton-polishes-it branch November 2, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant