Repository navigation
Count the jump where a definite integral crosses a branch cut off the real line, and take each case of a piecewise antiderivative across the range - #2465
Merged
Conversation
…ranch cut off the real line The breaks of an antiderivative were looked for on the real line, where arctan and the logarithm of a real argument have no cut to cross. A complex constant takes the argument off the line: arctan(t - 3i) meets arctan's cut at -3i and jumps by pi, so the integral of 1/(1 + (t - 3i)^2) over [-2, 2] was 2.8198 where it is -0.3218, and over the line pi where it is 0. The crossings of arctan's cut and the logarithm's are now placed for a polynomial argument with numeric coefficients, and for the logarithm of the cosine or the sine of a linear argument with numeric coefficients, which tan and cot integrate to: the cosine of p + i q is real where sin p = 0 or q = 0, a periodic set and a single point of t, and so is the sine where cos p = 0 or q = 0. Each jump is a whole multiple of pi or 2 pi i / ln(base), read from the values either side, and is counted with the node's coefficient; a bound on the cut takes the value from inside the range. Where a crossing cannot be placed or its jump is not a constant -- a power whose base crosses the negative real axis, a bound that is not a number, a symbol beside the complex constant, any other argument off the line -- the integral is left as written. A symbol is still read as real, as everywhere the breaks are read, so integral(1/(1+(t-y)^2), t, -oo, +oo) stays pi. Part of #2460 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ve splits on a parameter The antiderivative of 1/(t^2 + y^2) is a case split on y, and its case y = 0, -1/t, has a pole at 0. The breaks were looked for in the whole split, where the logarithm of the case y^2 < 0 cannot be listed, so none were looked for at all and the case y = 0 answered -1/t at the bounds: -2 over [-1, 1], 0 over the line, for a positive integrand whose integral diverges. A piecewise antiderivative whose conditions do not mention the variable is now taken across the range case by case, each with its own breaks, and the case y = 0 is +oo, as the integral of 1/t^2 over [-1, 1] is. The other cases are as they were. Part of #2461 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2465 +/- ##
==========================================
- Coverage 87.01% 86.94% -0.08%
==========================================
Files 320 320
Lines 71232 71398 +166
Branches 20775 20847 +72
==========================================
+ Hits 61985 62076 +91
- Misses 4961 5006 +45
- Partials 4286 4316 +30
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.
Two commits, one per issue, meant to be merged as they are (rebase, not squash). Both are about where a definite integral's antiderivative breaks inside the range.
Branch cuts crossed off the real line (#2460)
The breaks of an antiderivative were looked for on the real line with the parameters read as real, so a jump that comes from a complex shift was not counted, and the answer was off by a multiple of π.
AntiderivativeBreaks.CutCrossingsnow places the crossings ofarctan's cut (the imaginary axis beyond ±i) and the logarithm's (the negative real axis) for a polynomial argument with numeric complex coefficients, and ofln(cos(a t + b))andln(sin(a t + b))with numeric complexa,b(whattanandcotintegrate to: the argument isp + i qwith both linear int, real wheresin p = 0orq = 0). The jump at each is the node's coefficient times a whole multiple of π, or of2πi/ln(base), read numerically either side of the crossing and required to be whole within 1e-6.1/(1+(t-3i)^2), [−2, 2]pi01/(1+(t-3i)^2), [0, ∞)1/((1+i)t-5-3i), [0, 5]t/(1+(t-3i)^2), [−2, 2]tan(t+i), [0, 4]tan((1+i)t), [0, 4]tan((2-i)t+1/2), [0, 2]sqrt((1+i)t-5-3i), [0, 5]1/(1+(t-i)^2), [−1, 1]1/(1+(t-i/2)^2), (−∞, ∞)piEvery row checked against mpmath quadrature at 30 digits; real shifts are unchanged. Not answered, as before or newly: a non-integer power whose base crosses its cut inside the range (its jump is not a constant), a crossing with a symbolic bound or a symbol beside the complex constant, a crossing that coincides with a real break or sits at the end of a cut, a zero on the path, and any other function whose argument leaves the real line, apart from a list that is safe off it.
For a symbolic shift,
integral(1/(1+(t-y)^2), t, -oo, +oo)stayspi, which is right for |Im y| < 1. The rest of integration reads a bare symbol as real (the break search, the case splits ony^2), and no parametric definite answer carriesy in RR; adding it would make the answerNaN, "does not exist", aty = i/2, wherepiis right.Each case of a piecewise antiderivative across the range (#2461)
The antiderivative of
1/(t^2+y^2)is a piecewise ony. Its breaks were read for the whole piecewise, they^2 < 0case's could not be listed, and the integral fell back to substituting the bounds, so they = 0case's pole at 0 (-1/t) was never looked for. A piecewise antiderivative whose conditions do not mention the variable is now taken across the range case by case, each with its own breaks, which covers any special case that puts a pole in range. Divergence is written as the library writesintegral(1/t^2, t, -1, 1),+oo.y = 0case of1/(t^2+y^2), [−1, 1](-2) provided (y = 0)+oo provided (y = 0)0 provided (y = 0)+oo provided (y = 0)1/2Real
y ≠ 0is unchanged, checked against2·arctan(1/|y|)/|y|.Checks
IntegralAcrossABreakTest:Issue2460_*(24 + 4 rows),Issue2461_*(4 + 3). Calculus|Integra|Limit: 7139 → 7173 passed. Full check on the branch before the rebase onto 5ba95bc (clean): 20,052 unit tests, 0 failed; MCP 444, Terminal 69, F# 134, Interactive 19; AOT OK; BoundCheck 0 disagreements, RootCheck 596/596, CasBench 120/121 with 0 wrong, PropCheck 1355/0, SimpSweep 10463/10463, RuleCheck clean, CanonCheck and Confluence at their baselines. After the rebase (master gained #2463 and #2464, which changedDomainCondition), Calculus|Integra|Limit|Binder|FreeVariables|Domain: 8,320 passed, 0 failed.Closes #2460.
Closes #2461.
🤖 Generated with Claude Code