Skip to content

A definite integral with a parameter takes the limit at an infinite bound - #2462

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix/integral-infinite-bound-limit
Nov 15, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
fix/integral-infinite-bound-limit

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A definite integral evaluated its antiderivative at an infinite bound by substitution, and took a limit only where substituting gave NaN. With a parameter, substitution leaves an infinity inside a function (erf(+oo - y)), so the answer was left unfinished. AtAnInfiniteBound now also takes the one-sided limit there, from the left at +oo and the right at -oo, through the existing cached, budgeted LimitAtTheBound. The parameter is read as finite, since the integral is a function of the finite parameter.

The substituted value is kept exactly as before where the limit is undecided, is NaN, still holds an infinity (how the library says the answer depends on the parameter's sign, as for e^(+oo * -y)), or where the antiderivative holds an incomplete gamma; and the limit is taken only where the antiderivative has been read as continuous across the range.

input was (2.7.0) now
∫ e^(-(t-y)^2), -oo..+oo sqrt(pi)*(erf(+oo-y)-erf(-oo-y))/2 sqrt(pi)
∫ e^(-(t-y)^2), 0..+oo sqrt(pi)*(erf(+oo-y)-erf(-y))/2 sqrt(pi)*(1/2 + -1/2*erf(-y))
∫ 1/(1+(t-y)^2), -oo..+oo arctan((+oo-2y)/2)-arctan((-2y-+oo)/2) pi
∫ 1/(1+(t-y)^2), 0..+oo with +oo inside arctan pi/2 - arctan(-y)
∫ t e^(-(t-y)^2) / t^2 e^(-(t-y)^2), over R long, with infinities sqrt(pi)*y / sqrt(pi)*(1/2+y^2)
∫ e^(-(t-y)^2/2) / e^(-t^2-2yt), over R erf at ±oo sqrt(2pi) / sqrt(pi)*e^(y^2)

Every new answer agrees with mpmath quadrature to 40 digits at y = −2.3, −0.7, 0, 0.4, 1.9 (worst relative error 1.7e-41), the half-line answers differentiate back in y to e^(-y^2) and 1/(1+y^2), and each is smaller than what it replaces.

Declined, unchanged: ∫ e^(-y t), 0..+oo (depends on the sign of y), ∫ 1/(t-y)^2, 0..+oo (a pole that cannot be placed), ∫ 1/(t^2+y^2), -oo..+oo (the y^2 < 0 branch would give only a principal value), and a symbolic bound.

For complex y: the Gaussian answer holds for every complex y. ∫ 1/(1+(t-y)^2) over R is pi only for |Im y| < 1, and 0 beyond; master already answers pi for every concrete such y, which is #2460 (a branch cut crossed through a complex shift, also off by π on finite ranges), so this inherits that rather than adding to it. Found on the way, and also pre-existing: #2461.

ImproperIntegralTest: Issue2451_*, 15 rows; the 10 that assert an answer fail on master. Calculus|Limit|Integra: 7129 passed, 10 failed → 7139 passed, 0 failed. limitcheck summary identical on master and the branch.

Full check on this commit before the rebase onto e5f544f (clean): 19,983 unit tests, 0 failed; MCP 441, Terminal 69, F# 134, Interactive 19; AOT 78/78; BoundCheck 0 disagreements, RootCheck 596/596, CasBench 120/121 with 0 wrong, SimpSweep 10463/10463, RuleCheck clean, CanonCheck and Confluence at their baselines.

Closes #2451.

🤖 Generated with Claude Code

…nity inside the value

A definite integral to an infinite bound substituted the bound into the
antiderivative, and with a parameter beside it the infinity stayed inside a
function: erf(+oo - y), since y could itself be infinite. The limit at the
bound is now taken there, reading the parameter as the finite value an
integral with a parameter is a function of: e^(-(t - y)^2) over the line is
sqrt(pi), and 1/(1 + (t - y)^2) is pi.

It is taken only where the antiderivative was read to be continuous across
the range, numeric bounds with no break listed or all breaks listed, so that
1/(t^2 + y^2)'s logarithm for y^2 < 0, whose zeros move with y, is not
answered with its principal value. A limit that is undecided, undefined, or
still holds an infinity (e^(-y t), which depends on the sign of y) keeps the
substituted value as before.

Part of #2451

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 89.28571% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.00%. Comparing base (e5f544f) to head (6a20844).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...s/Continuous/Integration/Integration.Definition.cs 89.28% 0 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2462      +/-   ##
==========================================
+ Coverage   86.98%   87.00%   +0.01%     
==========================================
  Files         320      320              
  Lines       71174    71194      +20     
  Branches    20759    20769      +10     
==========================================
+ Hits        61914    61940      +26     
+ Misses       4970     4964       -6     
  Partials     4290     4290              
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.53% <89.28%> (+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 Δ
...s/Continuous/Integration/Integration.Definition.cs 90.74% <89.28%> (+0.14%) ⬆️

... and 8 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 e4f84aa 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/integral-infinite-bound-limit branch November 15, 2026 21:20
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 definite integral to an infinite bound substitutes the bound instead of taking the limit

1 participant