Skip to content

Decline a system whose exact row is shown not to be a solution - #2452

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix/pell-system-wrong-row
Nov 15, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
fix/pell-system-wrong-row

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

y^2 - 2, x^2 + (P - Q y) x - 3, with (1 + sqrt(2))^70 = P + Q sqrt(2), was
answered with the one row [-2P, -sqrt(2)], which leaves -2 in the second
equation, and its four solutions were lost.

The cause is the zero tolerance of a single equation's solve. It runs with
PrecisionErrorZeroRange at 1e-12, so P - Q sqrt(2) = 1.6e-27 is dropped as a
coefficient at y = sqrt(2) (roots +-sqrt(3)), and at y = -sqrt(2) the
discriminant and the small root are rounded away (the one root -2P). Without
that override the system is answered with four correct rows for n = 20..60;
at n >= 70 the default downcasting, 1e-50, still reads b^2 + 12 as 12. That
is downcasting itself, which v3 removes (#1019), and is left alone here.

The wrong row got through RowsThatHold because its residual is exact and
algebraic, and StatementSolver.IsEvidenceAgainst accepts such a residual up
to 1e-50 of the largest term: -2 against terms of 4e53 passed. A row with
only exact numbers is a solution only where each residual is exactly zero,
so an interval from PreciseEvaluation that leaves out zero proves it is
none. Such a row now declines the system rather than being dropped: that
the tolerance accepted it means rounding reached the elimination, which
lost true rows here too, and dropping it would answer an incomplete set.
The interval is taken to the working precision in decimal places, with a
second evaluation where the terms are large (n = 140 has terms near 1e107).
An enclosure that holds zero, or cannot be computed, changes nothing, so no
true row can be lost by the check.

Measured, master -> branch, rows checked at 150 digits with mpmath:
n = 5, 10 four correct rows -> unchanged
n = 20..60 declined -> declined
n = 70..120, 160 one wrong row [-2P, -sqrt(2)] -> declined
n = 140, 200 three wrong rows -> declined
System-solver filter 108 passed, 2 s before and after; Regression 411,
EquationSolving|SolveTest 192, Algebra|Corpus|Solv 2235, PublicApiSurface 1.

Generated systems (syscheck, 1,190 systems), master and branch: identical. 1128 answered, 62 declined, 0 wrong rows, 0 timeouts on both, so no system that master answered correctly is declined now.

Full check on this commit: 19,865 unit tests, every harness, and the AOT smoke test 78/78.

Fixes #2446. The single-equation half, the 1e-12 override itself, is #2448 and follows separately.

🤖 Generated with Claude Code

y^2 - 2, x^2 + (P - Q y) x - 3, with (1 + sqrt(2))^70 = P + Q sqrt(2), was
answered with the one row [-2P, -sqrt(2)], which leaves -2 in the second
equation, and its four solutions were lost.

The cause is the zero tolerance of a single equation's solve. It runs with
PrecisionErrorZeroRange at 1e-12, so P - Q sqrt(2) = 1.6e-27 is dropped as a
coefficient at y = sqrt(2) (roots +-sqrt(3)), and at y = -sqrt(2) the
discriminant and the small root are rounded away (the one root -2P). Without
that override the system is answered with four correct rows for n = 20..60;
at n >= 70 the default downcasting, 1e-50, still reads b^2 + 12 as 12. That
is downcasting itself, which v3 removes (#1019), and is left alone here.

The wrong row got through RowsThatHold because its residual is exact and
algebraic, and StatementSolver.IsEvidenceAgainst accepts such a residual up
to 1e-50 of the largest term: -2 against terms of 4e53 passed. A row with
only exact numbers is a solution only where each residual is exactly zero,
so an interval from PreciseEvaluation that leaves out zero proves it is
none. Such a row now declines the system rather than being dropped: that
the tolerance accepted it means rounding reached the elimination, which
lost true rows here too, and dropping it would answer an incomplete set.
The interval is taken to the working precision in decimal places, with a
second evaluation where the terms are large (n = 140 has terms near 1e107).
An enclosure that holds zero, or cannot be computed, changes nothing, so no
true row can be lost by the check.

Measured, master -> branch, rows checked at 150 digits with mpmath:
  n = 5, 10        four correct rows -> unchanged
  n = 20..60       declined -> declined
  n = 70..120, 160 one wrong row [-2P, -sqrt(2)] -> declined
  n = 140, 200     three wrong rows -> declined
System-solver filter 108 passed, 2 s before and after; Regression 411,
EquationSolving|SolveTest 192, Algebra|Corpus|Solv 2235, PublicApiSurface 1.

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

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.95%. Comparing base (f439c0e) to head (57fa858).

Files with missing lines Patch % Lines
...ath/Functions/Continuous/Solvers/EquationSolver.cs 71.42% 2 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2452      +/-   ##
==========================================
+ Coverage   86.93%   86.95%   +0.01%     
==========================================
  Files         319      319              
  Lines       70760    70781      +21     
  Branches    20666    20676      +10     
==========================================
+ Hits        61515    61545      +30     
+ Misses       4966     4957       -9     
  Partials     4279     4279              
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.48% <71.42%> (+0.01%) ⬆️
fsharp 32.97% <ø> (ø)
interactive 39.81% <ø> (ø)

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

Files with missing lines Coverage Δ
...ath/Functions/Continuous/Solvers/EquationSolver.cs 85.63% <71.42%> (-1.19%) ⬇️

... and 2 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 e059bc0 into master Nov 15, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 15, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the fix/pell-system-wrong-row branch November 15, 2026 16:15
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.

A system with large algebraic coefficients is answered with a row that is not a solution, and its four solutions are lost

1 participant