Skip to content

Remember the limits at a break as the limits at a bound are remembered (#2658) - #2662

Open
Rafael-SOWNet wants to merge 1 commit into
masterfrom
break-limits-cached-2658
Open

Rafael-SOWNet wants to merge 1 commit into
masterfrom
break-limits-cached-2658

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A definite integral across a break of its antiderivative takes the antiderivative's one-sided limits there. Those limits were taken directly, without the cache and the budget that LimitAtTheBound gives the limits at a bound, so every candidate Simplify tried paid for them again.

With a parameter, these limits are undecided after seconds each. The antiderivative of 1/(a + sin(x)) has a case for each sign of a^2 - 1, with a pole of tan(x/2) at pi in each case. Simplifying its integral over [0, 2 pi] therefore did not finish. With numbers, several integrals of 1/(A + B sin(x)) across pi took over thirty seconds.

The limits at a break now go through LimitAtTheBound's cache, but not its budget. A decided limit at a break can need more limits than the budget allows: the antiderivative of 1/((1 + x^2)^(1/3) (9 + x^2)) at 0 does. With the budget in place, EllipticLookingQuotientOfBinomialsTest failed. That is a refusal, and it was caught by the suite before commit.

simplified 2.10.0 / master, 20 s cap this branch
integral(1/(a + sin(x)), x, 0, 2 pi) did not finish unevaluated (8.5 s)
integral(1/(a + cos(x)), x, 0, pi) unevaluated (3.6 s) unevaluated (1.6 s)
integral(1/(3 + sin(x)), x, 0, 5) did not finish closed form = 1.688760915039694383…
integral(1/(4 - sin(x)), x, -7, -2) did not finish closed form = 1.360967949…
integral(1/(5 + 2 sin(x)), x, 2, 11) did not finish closed form (answered)

The parametric integral stays unevaluated, because it equals 2 pi / sqrt(a^2 - 1) only for a > 1 and diverges for |a| <= 1.

Checks

  • All seven numeric timeouts in the rational-trigonometric sweep are now answered, all matching mpmath. 0 wrong.
  • Diff of 300+ integrals against master: no other change.
  • The new test fails on master: the parametric case does not finish within 60 s.
  • Full UnitTests suite: 21868 passed, 0 failed, 13 skipped (net10.0).
  • The library builds with 0 errors for every target framework.

This change is independent of #2651, which speeds up the limit itself; the two complement each other.

Closes #2658.

🤖 Generated with Claude Code

#2658)

A definite integral across a break of its antiderivative takes the
antiderivative's one-sided limits there. Those were taken directly,
without the cache and the budget that LimitAtTheBound gives the limits
at a bound, so every candidate Simplify tried paid them again. With a
parameter they are undecided after seconds each. The antiderivative of
1/(a + sin(x)) has a case for each sign of a^2 - 1 and a pole of
tan(x/2) at pi in each, and simplifying its integral over [0, 2 pi] did
not finish. With numbers, several integrals of 1/(A + B sin(x)) across
pi took over thirty seconds.

The limits at a break now go through LimitAtTheBound's cache, but not
its budget. A decided limit at a break can take more limits than the
budget allows: the antiderivative of 1/((1 + x^2)^(1/3) (9 + x^2)) at 0
takes more, and with the budget that integral across 0 was left
unevaluated. The parametric integral is left unevaluated in seconds,
since it is 2 pi / sqrt(a^2 - 1) only for a > 1. The numeric ones are
answered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.71%. Comparing base (f8a822d) to head (97019a1).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2662      +/-   ##
==========================================
+ Coverage   86.70%   86.71%   +0.01%     
==========================================
  Files         346      346              
  Lines       75724    75739      +15     
  Branches    22145    22153       +8     
==========================================
+ Hits        65654    65680      +26     
+ Misses       5431     5424       -7     
+ Partials     4639     4635       -4     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.21% <100.00%> (+0.01%) ⬆️
fsharp 32.79% <ø> (ø)
interactive 40.09% <ø> (ø)

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 86.70% <100.00%> (+0.23%) ⬆️

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

integral(1/(a + sin(x)), x, 0, 2 pi) does not finish: the limits at a break are taken without the cache and budget of the limits at a bound

1 participant