Skip to content

A root in exact numbers is put back to the working precision - #2325

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
an-exact-root-is-checked-to-the-working-precision
Nov 2, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
an-exact-root-is-checked-to-the-working-precision

Conversation

@Rafael-SOWNet

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

Copy link
Copy Markdown
Member

Every root is put back into its equation, and IsEvidenceAgainst dropped one only where it left more than a hundredth of the largest term. That bound, RelativeResidualTolerance, was set for roots found numerically, which are only as accurate as the search.

A root in exact numbers, put into an equation of exact numbers, is evaluated to the working precision. A true root leaves only rounding, and a spurious one leaves a whole quantity. (3x - 4) sqrt(x) + 3 + 3x - 4x^2 = 0 is solved by squaring into a quartic. One of the quartic's roots, 1.3233 in radicals, leaves 0.069 against a largest term of 7, so the hundredth kept it. 2.6.0 and master answer it, beside the three true roots.

An equation and root that are exact numbers in sums, products, quotients and rational powers are now held to half the digits of DecimalPrecisionContext: 10^-50 of the largest term by default. That scales if a user lowers the precision. A function, a constant such as pi, or a decimal keeps the hundredth, because a special function may be evaluated in doubles, and a decimal is only as accurate as what found it. The same test reads a system's rows at rational sample points, which it holds the same way.

Generated equations, this branch against master at a2604a4, which is merged into it:

master this branch
radical cross-check, powers-of-x mode, 1000 at seed 41 1 non-root answered, the one above none
the same mode, 200 at seed 31 nothing nothing
default mode, 400 at seed 21 39 unsolved, nothing missed or wrong the same
random polynomials, 200 at seed 5 nothing nothing
the same with one coefficient times sqrt(2) or sqrt(3), 200 at seed 7 nothing nothing
generated systems, 1190 5 known solutions missing, 0 wrong rows the same

BREAKING-CHANGES.md has an entry. Test: AnExactRootIsCheckedToTheWorkingPrecisionTest, which fails on master.

🤖 Generated with Claude Code

Every root is put back into its equation, and IsEvidenceAgainst dropped one only
where it left more than a hundredth of the largest term. That bound was set for
roots found numerically, which are only as accurate as the search that found
them. A root in exact numbers, put into an equation of exact numbers, evaluates
to the working precision, so a true one leaves only rounding and a spurious one a
whole quantity, and the bound let a near spurious one through:
(3x - 4) sqrt(x) + 3 + 3x - 4x^2 = 0 is solved by squaring into a quartic, and
one of the quartic's roots, 1.3233 in radicals, leaves 0.069 against a largest
term of 7. 2.6.0 and master answer it.

An equation and root that are exact numbers in sums, products, quotients and
rational powers are now held to half the digits of DecimalPrecisionContext,
10^-50 of the largest term by default. A function, a constant such as pi, or a
decimal keeps the hundredth: a special function may be evaluated in doubles, and
a decimal is only as accurate as what found it. The same test reads a system's
rows, which it holds the same way.

Generated equations against master: the radical cross-check's powers-of-x mode,
1000 at seed 41, goes from 8 findings to 7, the unsound 1.3233 removed; the 7 are
roots of polynomials, which #2324 answers. At seed 31 (200), the default mode (400
at seed 21), random polynomials (200 at seed 5) and generated systems (1190) are
unchanged.

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

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.74%. Comparing base (a2604a4) to head (c88f9fe).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2325      +/-   ##
==========================================
- Coverage   86.74%   86.74%   -0.01%     
==========================================
  Files         312      312              
  Lines       68422    68437      +15     
  Branches    19899    19907       +8     
==========================================
+ Hits        59351    59363      +12     
- Misses       4914     4916       +2     
- Partials     4157     4158       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.28% <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/EquationSolver/SolveStatement.cs 83.72% <100.00%> (+1.22%) ⬆️

... and 5 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 and others added 2 commits November 2, 2026 03:10
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ated

The exact branch of IsEvidenceAgainst evaluated every term of the equation
again for the largest, which the decimal branch skips for a residual under
10^-6. A true root in exact numbers leaves 0 at the working precision, and no
more than share^2 is under the bound whatever the terms are. The exactness
check walks the tree by hand: Nodes builds lazy enumerators over a fresh
substitution for every root checked.

SolveEasy allocated 491,797 B/op against master's 452,228, +8.7%, and the
gate refused it at 9.8%; now 452,580, +0.08%.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Rafael-SOWNet
Rafael-SOWNet merged commit b2b6abf 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 an-exact-root-is-checked-to-the-working-precision branch November 2, 2026 04:43
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