Repository navigation
Take a rational integral down to -oo as its reflection up to +oo (#2646) - #2647
Merged
Merged
Conversation
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 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2647 +/- ##
=======================================
Coverage 86.71% 86.71%
=======================================
Files 346 346
Lines 75647 75660 +13
Branches 22114 22118 +4
=======================================
+ Hits 65596 65610 +14
+ Misses 5420 5418 -2
- Partials 4631 4632 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
An antiderivative's sum over roots is taken at
+oothrough Euler–Jacobi (#2630, #2636), but at-ooeachln(x - r)approaches the logarithm's cut from a side that depends on the sign ofIm r. For a real root computed to a hundred digits, that sign is not decided. So a rational integral down to-oo, or over the whole line, was left unevaluated wherever its antiderivative has a root sum. 2.10.0 answeredNaN.The integral of
fover(-oo, b]equals the integral off(-t)over[-b, +oo)exactly, so no branch question arises. Over the whole line the integral is split at 0. This is 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)^3reads as a polynomial.I used the reflection instead of the per-root branch formula
θ_r = π(1 − sgn Im r − |sgn Im r|)that I had proposed. That formula needs the sign ofIm rfor every root, and a numerically computed real root can carry an imaginary part of±1e-100. Getting that sign wrong for a real root would put a spurious±π c(r) iinto the answer. The reflection never asks for that sign.integral(1/(x^3 + 3x - 1), x, -oo, -1)NaNintegral((x - 2)/(x^4 + 3x + 1), x, -oo, -2)integral(1/(x^3 + x + 1), x, -oo, -1)NaNintegral(1/(x^4 + x + 1), x, -oo, +oo)NaNintegral(1/(x^3 + x + 1), x, -oo, +oo)Checks
1/(x^3+x+1)over(-oo, -1]changed, and it now matches mpmath.Closes #2646.
🤖 Generated with Claude Code