Repository navigation
Take a sum over roots to 0 at +oo, and break it at a real root (#2624) - #2630
Merged
Merged
Conversation
The antiderivative of 1/(x^3 + x + 1) is sum(ln(x - r) / (3 r^2 + 1), r) over the roots of r^3 + r + 1. At an infinite bound it was substituted and left with +oo inside. Nothing settles that sum, and it evaluates to NaN, so the integral over [0, +oo) simplified to NaN where it is 0.92176. Its breaks were never listed either: ln(x - r) holds the bound r, whose zeros the solver cannot place. So over [-1, 0] the root sum was taken across the real root -0.6823 as if it were continuous, and the divergent integral came out as a complex number. At +oo, a root sum sum(c(r) ln(x - r)) is (sum c(r)) ln(x) plus terms that tend to 0. Where c(r) p'(r) is a polynomial of degree at most deg p - 2 and p is square-free, the Euler-Jacobi identity makes sum c(r) exactly 0, and the root sum is 0 at the bound. This is the condition for convergence of a rational integrand at +oo. A root sum not shown to vanish, and any root sum at -oo, leaves the bound with no value instead of NaN. The breaks of a root sum are now the real zeros of its polynomial in x. A real root inside the range therefore leaves the integral unevaluated unless the one-sided limits settle. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2630 +/- ##
==========================================
- Coverage 86.71% 86.70% -0.02%
==========================================
Files 345 345
Lines 75396 75447 +51
Branches 22036 22057 +21
==========================================
+ Hits 65377 65413 +36
- Misses 5409 5413 +4
- Partials 4610 4621 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Member
Author
|
Note: the squash commit a3b3d25 on master went in with the wrong subject line. It repeats #2626's. The subject should read "Take a sum over roots to 0 at +oo, and break it at a real root (#2630)". The body and the diff are this PR's, as intended. The full suite passed (21796) on master merged with #2631, #2629 and this PR. |
This was referenced Nov 28, 2026
Rafael-SOWNet
added a commit
that referenced
this pull request
Nov 29, 2026
) A sum over roots sum(c(r) ln(x - r)) is (sum c(r)) ln(x) plus terms that tend to 0 at +oo. #2630 took it at +oo only where sum c(r) is 0 on its own. The antiderivative of (x + 2)/(x^4 - 2x^3 - 2x + 3) is -3/4 ln(x - 1) beside a sum with sum c(r) = 3/4. The two cancel only together, and the integral over [3, +oo) was left unevaluated. By the Euler-Jacobi identity, sum c(r) is exactly the coefficient of r^(n - 1) in c(r) p'(r) over p's leading coefficient. Each sum now stands at the bound as that multiple of ln(x), which differs from it by terms that tend to 0, so the gathering of logarithms cancels it with the others. Where nothing cancels the integral diverges, and it is now +oo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 29, 2026
Rafael-SOWNet
added a commit
that referenced
this pull request
Nov 29, 2026
…) (#2647) An antiderivative's sum over roots is taken at +oo (#2630, #2636) but not at -oo, where each ln(x - r) nears the logarithm's cut from a side that depends on the sign of Im r. A root computed to a hundred digits does not decide that sign for a real root. So 1/(x^3 + 3x - 1) over (-oo, -1] was left unevaluated while its mirror over [1, +oo) was answered, and 2.10.0 answered it NaN. The integral of f over (-oo, b] equals the integral of f(-t) over [-b, +oo) exactly, and over the whole line the integral is the two halves split at 0. That is now the last route tried for a lower bound at -oo, after every other route has declined. The reflected integrand is simplified first, so that (-x)^3 reads as the polynomial -x^3. A pole on the line still leaves no finite value. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two wrong answers came from the root-sum antiderivative
sum(c(r) ln(x - r), r in { r : p(r) = 0 }):+ooinside. That evaluates toNaN, sointegral(1/(x^3+x+1), x, 0, +oo)simplified toNaN.ln(x - r)holds the bound variabler. Sointegral(1/(x^3+x+1), x, -1, 0), which diverges at the root-0.6823…, came out as a complex number.Fix
+oo:sum c(r) ln(x - r) = (sum c(r)) ln(x) + sum c(r) ln(1 - r/x). The second part tends to 0.pis square-free andc(r) p'(r)is a polynomial of degree at mostdeg p - 2, the Euler–Jacobi identity makessum c(r) = 0exactly. The root sum is then 0 at the bound.+oorequires of a rational integrand.NaN.-oo: the bound has no value, sinceln(x - r)takes a branch that depends on each root.AntiderivativeBreaks.Inside): a root sum now breaks at the real zeros of its polynomial inx, so a real root inside the range is no longer jumped over.integral(1/(x^3+x+1), x, 0, +oo)NaN-sum(ln(-r) / (1 + 3 r^2), r…)integral(1/(x^3-x^2+1), x, 0, +oo)NaNintegral(1/(x^5+x+1), x, 0, +oo)NaNintegral(1/(x^5+x+1), x, 1, +oo)integral(x/(x^3+x+1), x, 0, +oo)integral(1/(x^5+3x+5), x, 0, +oo)integral(1/(x^3+x+1), x, -1, 0)integral(1/(x^3+x+1), x, -oo, 0)NaNintegral(x^2/(x^3+x+1), x, 0, +oo)NaNChecks
1/(x^5+x+1)over[0, +oo).This touches
Integration.Definition.cs, the same file as #2626, but inAtTheBoundand a new function, not inWithItsLogarithmsGathered. TheBREAKING-CHANGES.mdentry sits where #2626's ends, so one of the two will need a mechanical merge round.Closes #2624.
🤖 Generated with Claude Code