Skip to content

Search for numeric roots at the sizes of the equation's numbers (#2643) - #2644

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
newton-scale
Nov 29, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
newton-scale

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Closes #2643

The numeric root search starts from a grid from -10 to 10 (NewtonSetting.From/To), and its tolerances are absolute: the settling step from 1 up, and the residual a root is kept by. 10^20 arcsin(x / 10^20) = x pi / 3 has the roots of arcsin(t) = t pi / 3 times 10^20 and was answered with { 0 }, as was every k ≠ 0 of 10^k arcsin(x / 10^k) = x pi / 3. (Written as a substitution, arcsin(x / K) = x pi / (3 K), the solver solves for t first and the grid is never involved.)

The equation is now searched once more for each decimal size of its whole and rational numbers (at least two orders from 1, at most six sizes), in x = 10^e t with its values divided by their size at a few unit-size points, and the roots are put back exactly by a power of ten and de-duplicated relatively. A search at another size that cannot be run, or whose points are not isolated, is skipped, so it adds roots but never declines an equation the unit-size search answered. Entry in BREAKING-CHANGES.md.

Measured: over 84 equations K F(x / K) = 0 (K = 10^k, k = -30..30 step 3; F among arcsin(t) - t pi/3, arctan(t) - t/2, arcsin(t) - t/2 - t^3, tanh(t) - t/2), complete real root sets go from 9 to 84, with no false root added. cxcheck's scale differences at x:10^∓30 (15 and 45 of 200) are unchanged: they come from ModulusSolver/the Gröbner path's exact verification, not from this search.

A root from another size is added only where it holds as written (second commit): the extra searches run on the equation divided by its value size, so a point near 0 of (1 + 4·10^30 x)^(1/3) + sqrt(-1 - 10^30 x) = -4 passed the search's absolute floor, was dropped by verification, and left { } where master declines. NewtonSolver.HoldsAsWritten now admits a root from another size only where the original equation is defined and IsEvidenceAgainst does not count its residual against it, so the other sizes can only add verified roots and never turn a decline into { }. radcheck at x:10^-30, 10^-20, 10^-12 and 10^30 now matches master (0 of 200 differ each); the family stays 84 of 84.

Not fixed here: 10^3 tanh(x / 10^3) = x / 2 still keeps a false root near 1.1e-13 beside 0 (pre-existing; the residual is judged on the exponential rewrite, whose terms cancel near 0). Filed as #2645.

Full UnitTests suite (net10.0, on e095094 + this): 21820 passed, 0 failed, 13 skipped (both commits).

🤖 Generated with Claude Code

The numeric search starts from a grid from -10 to 10 (NewtonSetting.From
and To). Its tolerances are made for roots and values of about unit size:
the step it settles to is absolute from 1 up, and a root is kept by an
absolute residual. 10^20 arcsin(x / 10^20) = x pi / 3 has the roots of
arcsin(t) = t pi / 3 times 10^20, and it was answered with 0 alone, as
was every k other than 0 in 10^k arcsin(x / 10^k) = x pi / 3, for k from
-30 to 30 in steps of 3. Where the scaling is a substitution t = x / K,
as in arcsin(x / K) = x pi / (3 K), the solver solves for t first and
the grid is never at fault. Written K F(x / K) = 0, it is not.

The equation is now searched once more for each decimal size of its whole
and rational numbers, at least two orders from 1 and at most six of them.
Each search is in x = 10^e t, with the values divided by the power of ten
nearest their size at a few unit-size points, so the existing grid and
tolerances meet roots and values of unit size. The roots are put back,
exactly, by a power of ten. A root found at more than one size is kept
once, compared relatively. A search at another size that cannot be run,
or whose points are not isolated, is skipped, so it can add roots but
never decline an equation the unit-size search answered. Over 84
equations in four families of K F(x / K), complete real root sets go
from 9 to 84.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.10526% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.71%. Comparing base (e095094) to head (7fc3103).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
...ontinuous/Solvers/NumericalSolving/NewtonSolver.cs 92.10% 1 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2644      +/-   ##
==========================================
- Coverage   86.72%   86.71%   -0.01%     
==========================================
  Files         345      346       +1     
  Lines       75569    75685     +116     
  Branches    22086    22128      +42     
==========================================
+ Hits        65540    65634      +94     
- Misses       5410     5418       +8     
- Partials     4619     4633      +14     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.21% <92.10%> (-0.01%) ⬇️
fsharp 32.79% <ø> (ø)
interactive 40.09% <ø> (ø)

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 93.54% <92.10%> (-0.31%) ⬇️

... and 9 files with indirect coverage changes

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

A search at another size runs on the equation divided by the size of its
values at a few unit-size points. A point where the equation is small
beside that size passes the search's absolute residual floor without
being a root. (1 + 4 10^30 x)^(1/3) + sqrt(-1 - 10^30 x) = -4 has no
roots. It is about 10^30 in size away from 0 and 5 + i at 0, and the
search at 10^30 returned 0. AnalyticalEquationSolver took that non-empty
result as the search's answer. WithoutSpuriousRoots then dropped 0 as no
root, and the equation was answered { }, where a search that finds
nothing leaves it unsolved. Two more x-scaled radcheck equations went
the same way.

A root from another size is now added only where it holds in the
equation as written: defined there, and with a residual that
StatementSolver.IsEvidenceAgainst does not count against it beside the
equation's terms. The other sizes can then only add verified roots, and
cannot turn an empty unit-size search into a non-empty one that
verification then empties. The three radcheck equations are unsolved
again, as on master. radcheck at x:10^(-30), x:10^(-20), x:10^(-12) and
x:10^30 agrees with master: 0 of 200 differ at each. The K F(x/K) family
is still 84 of 84 complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet
Rafael-SOWNet merged commit 30b2592 into master Nov 29, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 29, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the newton-scale branch November 29, 2026 07:52
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.

The numeric root search misses roots far from unit size: 10^20 arcsin(x / 10^20) = x pi / 3 is { 0 }

1 participant