Skip to content

A polynomial with no roots in closed form is answered with all of them - #2324

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-polynomial-with-no-closed-form-has-all-its-roots
Nov 1, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-polynomial-with-no-closed-form-has-all-its-roots

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A polynomial equation with rational coefficients that no route writes in radicals could be answered with some of its roots: x^5 - 30x^4 + 1 = 0 came back with one root of five. Two defects did this.

  1. SolveMultiplicative substituted x to the least of the powers. x^5 - 30x^4 + 1 was written in t = x^4, with x^5 as t^(5/4), which is not x^5 off the positive reals. x^4 - 3x^(5/2) + 2 was written in t = x^(5/2) and lost two of its four roots. The substitution is now x to the greatest common divisor of the powers where they are rational, so each power is a whole power of it, and there is none where that divisor is 1. For irrational powers it is the least of them, and only where each is a whole multiple of it.
  2. A polynomial went to Newton's method. The search starts inside a bounded region and answered the roots it found there as though they were all. Before the search, a polynomial with rational coefficients now goes to the Durand–Kerner iteration that SumOverSet.NumericRoots already runs. It settles every root of each square-free part at once, or answers nothing. It is numerical, so it runs only where Newton's method would: with AllowNewton off, the answer is still analytical or the equation itself.

Each fix alone leaves cases the other one removes, so they share a PR.

Random integer polynomials of degree 5 to 8, checked against mpmath's polyroots, 200 per seed:

seed 5 seed 6
2.6.0 51 roots missed, in 15 polynomials 50, in 18
master 6, in 4 17, in 12
this branch none none

The radical cross-check's powers-of-x mode (200 at seed 31) goes from 2 roots missed to none. Those are the two #2323 left, roots of a degree-7 polynomial near 23 and -26. Its default mode (400 at seed 21) is unchanged: the same 39 sums of two radicals are left unsolved, and nothing is missed or wrong on either build.

A root found by Durand–Kerner carries MathS.Settings.DecimalPrecisionContext's digits, so a polynomial Newton's method did answer in full now has the same roots with more digits. BREAKING-CHANGES.md has an entry. Test: APolynomialWithNoClosedFormHasAllItsRootsTest; five of its six cases fail on master. The sixth checks that x^6 + x^3 + 1 is still answered exactly.

One thing this exposed. On master without #2323, a spurious candidate from squaring twice reached the solution check, missing by 0.97% of its largest term, and was kept, because RelativeResidualTolerance is 1%. That tolerance was set for Newton's double roots. With #2323 in, no case of it appears in these 1,000 equations, but a candidate found to 100 digits could be held to much less. I'll look at that separately.

🤖 Generated with Claude Code

Two defects lost roots of a polynomial equation with rational coefficients that
no route writes in radicals.

SolveMultiplicative solved an equation in powers of x through x to the least of
its powers. x^5 - 30x^4 + 1 was written in t = x^4 with x^5 as t^(5/4), which is
not x^5 off the positive reals, and x^4 - 3x^(5/2) + 2 in t = x^(5/2) with x^4 as
t^(8/5), which lost two of its four roots. The substitution is now x to the
greatest common divisor of the powers where they are rational, so each is a whole
power of it, and none where that divisor is 1. Where they are not rational it is
the least of them only when each is a whole multiple of it.

And a polynomial reached Newton's method, which starts from points inside a
bounded region and answered the roots it found there as though they were all:
x^5 - 30x^4 + 1 = 0 has a root near 30 and was answered with one root of five.
Before the search, a polynomial with rational coefficients is now given to the
Durand-Kerner iteration that SumOverSet.NumericRoots already runs, which settles
every root of each square-free part at once or answers nothing. It is numerical,
so it runs only where Newton's method would: with AllowNewton off the answer is
still analytical or the equation itself.

Random integer polynomials of degree 5 to 8 against mpmath's polyroots (e387
polycheck, 200 each): at seed 5, 2.6.0 missed 51 roots in 15, master 6 in 4, and
this none; at seed 6, 50 in 18, 17 in 12, and none. The radical cross-check's
powers-of-x mode (200 at seed 31) goes from 2 roots missed to none, the two
being roots of a degree-7 polynomial near 23 and -26. Its default mode (400 at
seed 21) is unchanged: the same 39 sums of two radicals unsolved, nothing missed
or wrong on either.

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

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.75%. Comparing base (09a132d) to head (a139459).

Files with missing lines Patch % Lines
...inuous/Solvers/EquationSolver/ExponentialSolver.cs 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2324      +/-   ##
==========================================
- Coverage   86.76%   86.75%   -0.01%     
==========================================
  Files         312      312              
  Lines       68374    68388      +14     
  Branches    19885    19889       +4     
==========================================
+ Hits        59325    59331       +6     
- Misses       4891     4900       +9     
+ Partials     4158     4157       -1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.30% <88.23%> (-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 Δ
...Solvers/EquationSolver/AnalyticalEquationSolver.cs 95.94% <100.00%> (+0.05%) ⬆️
...inuous/Solvers/EquationSolver/ExponentialSolver.cs 86.36% <86.66%> (-3.44%) ⬇️

... 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
Rafael-SOWNet merged commit 1e5318c into master Nov 1, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 1, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-polynomial-with-no-closed-form-has-all-its-roots branch November 1, 2026 23:09
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