Skip to content

Read a grown derivatives' quotient in a limit by its terms - #2399

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/limit-of-a-grown-quotient-without-another-step
Nov 9, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/limit-of-a-grown-quotient-without-another-step

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

l'Hopital's rule bounds how much its derivatives' quotient may grow. A quotient past that bound was taken only where it had a finite value at the point. (sqrt(x) - erf(x)) / x at 0 from the right steps to 1/2 * x^(-1/2) - 2 / sqrt(pi) * e^(-x^2), which is +oo there and has no value, so master left the limit unevaluated where 2.6.0 answered +oo. Written (g - 0) / (x - 0), the same quotient fit inside the bound by the two nodes the zeros add. That is the only reason floor(sqrt(x) - erf(x)) at 0 from the right still answers on master, since its sign is read from that slope.

The fix. For a one-sided limit at a finite point, a quotient past the bound is now also read a term at a time. Each term is either a value at the point, or a negative power of the distance to the point times factors with non-zero values there: a pole whose sign the side decides. Poles of one sign give that infinity. Poles of both signs, a non-integer power from the left, or anything else are declined as before. From the left, (sqrt(x) - erf(x)) / x stays unevaluated. Its limit is -2/sqrt(pi) - oo i, a directed complex infinity.

A first version asked the grown quotient's limit with the rule kept out of it. It answered the same, but limitcheck found 13 new limits that no longer finished in 5 s. The descent took seconds on the quotients that grow the most, and 30 s on cos(tanh(x))^log(x + 1, tanh(x)). Reading the terms costs a substitution each.

Measured on 2.6.0, master (69aa9bd) and this branch, at 0 from the right:

Limit 2.6.0 master this branch
(sqrt(x) - erf(x)) / x +oo unevaluated +oo
(sqrt(x) + erf(x)) / x +oo unevaluated +oo
(erf(x) - sqrt(x)) / x -oo unevaluated -oo
(x^(1/3) - erf(x)) / x +oo unevaluated +oo
(sqrt(x) - erf(x)) / (2 * x) unevaluated unevaluated +oo

Only the last row changes against 2.6.0, and a BREAKING-CHANGES entry records it. Each takes about 0.2 s.

limitcheck, 42 seeds at depth 3 with 600 expressions each, against master: identical, with no losses, wrong answers or new timeouts.

Checks: the full suite passed (19199 tests), as did the MCP, terminal, interactive and F# wrapper suites, the AOT build and the eight harnesses.

New test: AGrownQuotientIsReadWithoutAnotherStepTest.

🤖 Generated with Claude Code

l'Hopital's rule bounds how much its derivatives' quotient may grow, and a
quotient past the bound was taken only where it had a value at the point.
(sqrt(x) - erf(x)) / x at 0 from the right steps to
1/2 * x^(-1/2) - 2 / sqrt(pi) * e^(-x^2), which is +oo there and has no
value, so the limit was left unevaluated where 2.6.0 answered +oo. Written
(g - 0) / (x - 0) the same quotient fit inside the bound, by the two nodes the
zeros add.

Such a quotient is now also read a term at a time from one side: each term a
value at the point, or factors with non-zero values there times a negative
power of the distance to it, a pole whose sign the side decides. Poles of one
sign are that infinity; of both signs, or a non-integer power from the left,
the quotient is declined as before. Asking the grown quotient's limit with the
rule kept out of it answered the same, but its descent took seconds on the
quotients that grow the most and thirty on one of them; this costs a
substitution per term.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 9, 2026
@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.86207% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.80%. Comparing base (69aa9bd) to head (9b53e0f).

Files with missing lines Patch % Lines
...ath/Functions/Continuous/Limits/Transformations.cs 75.86% 5 Missing and 9 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2399      +/-   ##
==========================================
- Coverage   86.81%   86.80%   -0.02%     
==========================================
  Files         312      312              
  Lines       69272    69330      +58     
  Branches    20202    20230      +28     
==========================================
+ Hits        60141    60184      +43     
- Misses       4913     4919       +6     
- Partials     4218     4227       +9     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.34% <75.86%> (-0.02%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ath/Functions/Continuous/Limits/Transformations.cs 88.05% <75.86%> (-0.92%) ⬇️

... and 3 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 b1d0c22 into master Nov 9, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 9, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/limit-of-a-grown-quotient-without-another-step branch November 9, 2026 13:48
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.

1 participant