Skip to content

Ask the whole limit of an indeterminate quotient a function holds - #2358

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
an-indeterminate-quotient-inside-a-function-is-asked-whole
Nov 4, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
an-indeterminate-quotient-inside-a-function-is-asked-whole

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Found while checking a limit limitcheck reported. No issue was filed.

at 0 2.6.0 and master now
(sin(x)/x)^2 NaN 1
exp(sin(x)/x) NaN e
limitright(exp(sin(x)/x), x, 0) unevaluated e
sin(sin(x)/x) NaN sin(1)
exp((cos(x) - 1)/x^2) NaN e ^ (-1/2)
sin(x)/x, exp(x/x), (2^x - 1)/x 1, e, ln(2) unchanged

A function of a quotient took the quotient's limit from the descent alone. The descent reads 0/0 or oo/oo off the two parts as NaN, the claim that there is no limit, where it only cannot tell. The whole limit reaches sin(x)/x = 1 through the first remarkable limit, but a function wrapped round it never asked the whole limit. Sums and products of it already worked.

The change. Where a quotient's descent would return NaN for an indeterminate form and nothing else answers, the quotient's whole limit is asked once, and only a value is taken; otherwise what was answered is kept. So the change can turn a NaN from 0/0 or oo/oo into a value, and nothing else. Three things keep it from costing what it answers, each found by the suite:

  • One level. No whole limit is asked inside another.
  • Not under a caller's budget of limits (remainingLimits), which it would spend.
  • The form is folded. A limit can come back holding the infinity it was taken at: -4/9 * 0 * (1 - (1 + (1/+oo)^2)^(1/3)) for a quotient in a definite integral's antiderivative. Handed on as written, it left integral(1/((1 + x^2)^(1/3) (9 + x^2)), x, -1, 1) unevaluated after two minutes, where master gives it in 4 s. Folded, that form is 0, and ln(2) * 2^(1/+oo) is ln(2). A form is taken as its number only where an infinity is still in it.

limitcheck at SEED=14 and 16, and at DEPTH=3 on 19 and 23 (the last rebased onto #2357), gains cos(sin(x)/x), (x/arctan(x))^3 and 1/(x/abs(x)) at 0 from each side, each agreeing with the values. It has the same number of limits of another value as master on every seed, and fewer NaNs where the values settle. 4180 limit and integration tests pass.

Still NaN, and not reached by this: the 1^oo powers (cos(x))^(1/x^2) and (sin(x)/x)^(1/x^2), which take the indeterminate-power route.

Tests: AFunctionOfAnIndeterminateQuotientTest, 8 cases. 6 fail on master; the 2 controls pass on both. The full suite, AOT and the nine harnesses pass. There is a BREAKING-CHANGES entry, measured on 2.6.0.

🤖 Generated with Claude Code

A function of a quotient took the quotient's limit from the descent
alone, which reads 0/0 or oo/oo off the two parts as NaN -- the claim
that there is no limit -- where only the descent cannot tell. sin(x)/x
at 0 is 1, which the whole limit reaches through the first remarkable
limit; (sin(x)/x)^2, exp(sin(x)/x), sin(sin(x)/x) and
exp((cos(x) - 1)/x^2) came out NaN two-sided and unevaluated from
either side. 2.6.0 answers the same.

Where the descent of a quotient would return NaN for an indeterminate
form and nothing else answers, the quotient's whole limit is asked once,
and only a value is taken. Three things keep it from costing what it
answers:

- One level: no whole limit is asked inside another.
- Not under a caller's budget of limits, which it would spend.
- The form a limit comes back in can hold the infinity it was taken at:
  -4/9 * 0 * (1 - (1 + (1/+oo)^2)^(1/3)), handed on as written, left a
  definite integral across 0 unevaluated. It is folded first, which
  makes it 0 and ln(2) * 2^(1/+oo) ln(2), and taken as its number only
  where an infinity is still in it.

limitcheck on SEED=14 and 16, and at DEPTH=3 on 19 and 23, gains
cos(sin(x)/x), (x/arctan(x))^3 and 1/(x/abs(x)) at 0, each agreeing with
the values, and no limit of another value. 4180 limit and integration
tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Nov 4, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 4, 2026
@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.78%. Comparing base (f86d0a2) to head (dadaaf4).

Files with missing lines Patch % Lines
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 80.95% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2358      +/-   ##
==========================================
+ Coverage   86.76%   86.78%   +0.02%     
==========================================
  Files         312      312              
  Lines       68786    68807      +21     
  Branches    20039    20045       +6     
==========================================
+ Hits        59679    59712      +33     
+ Misses       4923     4910      -13     
- Partials     4184     4185       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.32% <81.81%> (+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 Δ
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 90.86% <100.00%> (+0.04%) ⬆️
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 73.33% <80.95%> (+0.53%) ⬆️

... and 7 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 553e68d into master Nov 4, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 4, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the an-indeterminate-quotient-inside-a-function-is-asked-whole branch November 4, 2026 01:48
Rafael-SOWNet added a commit that referenced this pull request Nov 4, 2026
The second remarkable limit writes a 1^oo power f^g as e^(g (f - 1)),
and the product in its exponent the descent read as 0 * oo, NaN, the
claim that there is no limit. Only a base of 1 plus a polynomial was
answered, by another route: (cos(x))^(1/x^2) at 0, which is e^(-1/2),
was NaN, and from the right unevaluated. 2.6.0 answers the same.

The exponent is (f - 1) / (1/g) now, a 0/0 that a function of an
indeterminate quotient asks whole since #2358. Asking a product whole
in the descent instead answered these too, and also answered
x * ln(x) at 0 two-sided with 0, which the two-sided reading keeps NaN,
its left side not being real; the quotient keeps that convention.

limitcheck on SEED=14 and 16, and at DEPTH=3 on 19 and 23, is master's
exactly; 4194 limit, integration and remarkable-limit tests pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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