Skip to content

Turn l'Hôpital away from a quotient whose whole powers grow - #2357

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
a-quotient-whose-powers-grow-is-not-differentiated
Nov 4, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
a-quotient-whose-powers-grow-is-not-differentiated

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A hang since #2306, and a wrong answer since before 2.6.0, in one l'Hôpital chain. limitcheck found it at DEPTH=3, SEED=23. No issue was filed.

at 0 from the right 2.6.0 master now
(-ln(2)/ln(x))^(exp(x) - 1) 1, 4.5 s does not finish in 10 min 1, 6.1 s
(log(x, 1/2))^(exp(x) - sgn(x)) 0 does not finish 1, 3.4 s

The chain. It's the form 0^0, and its exponent's logarithm is a 0·∞ product. Written as x^n / (1 / g^k) with g = e^(-1/x) - 1 after the substitution to +oo, each application differentiates 1/g^k into a quotient over g^(2k). So k went 6, 12, 24, …, every quotient was asked twice per depth, and the inner limits expanded the growing powers (stack: PolynomialLongDivision → DivideOnePolynomial → Expand). GrewTooMuch turns a step away by node count, and (…)^12 and (…)^24 have the same nodes. MaxlHopitalApplications was never reached, because the cost is inside each application.

Why it started. Bisected to #2306 ("A factor a numerator's terms hold to a power cancels"). Before it, the limit took a different arrangement at its fourth step and settled in 4.4 s. The l'Hôpital traces of the two builds agree through three levels and their simplified results. #2306 changed which route is reached afterwards, not the simplification of these quotients, so this does not undo it.

The fix. GrewTooMuch also adds up the quotient's whole exponents, with the same room as for nodes: the larger of eight more and three fifths again. A chain that is getting somewhere lowers its degrees.

limitcheck at SEED=16, and at DEPTH=3 on SEED=19 and 23, changes only the limit that did not finish, which now agrees with the values. Every other answer and decline is master's. The 752 limit tests pass, 1/x^2 - 1/sin(x)^2 among them; its chain is the one the node budget's comment was written for.

Tests: AQuotientWhosePowersGrowIsNotDifferentiatedTest, 5 cases. The two 0^0 limits fail on master by the one-minute cap; the three chains that settle 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

GrewTooMuch turned the rule away where a quotient grew in nodes, and a
chain whose divisor is a reciprocal power, x^n / (1 / g^k), grows in its
exponents instead: the derivative of 1/g^k is over g^(2k), so k doubled
at each step with the node count flat, and the inner limits expanded the
powers. The limit of (-ln(2)/ln(x))^(e^x - 1) at 0 from the right went
6, 12, 24, ... and did not finish in ten minutes; it is 1, which 2.6.0
answered and #2306 stopped answering (bisected: #2306's factor taken out
of a sum changed the route into this chain). The spelling with log(x, 1/2)
and sgn(x) was 0 in 2.6.0 and hung on master.

The sum of the whole exponents is measured as the nodes are, with the
same room, the larger of eight more and three fifths again: a chain that
is getting somewhere lowers its degrees. Both limits are 1, in 6 s and
3.4 s. limitcheck at SEED=16, and at DEPTH=3 on SEED=19 and 23, changes
only the limit that did not finish; 752 limit 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 3, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Nov 3, 2026
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.77%. Comparing base (195da7f) to head (b0bb3ae).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2357      +/-   ##
==========================================
+ Coverage   86.76%   86.77%   +0.01%     
==========================================
  Files         312      312              
  Lines       68783    68786       +3     
  Branches    20037    20039       +2     
==========================================
+ Hits        59679    59692      +13     
+ Misses       4915     4909       -6     
+ Partials     4189     4185       -4     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.32% <100.00%> (+0.01%) ⬆️
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 87.82% <100.00%> (+0.06%) ⬆️

... and 9 files with indirect coverage changes

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

…he hang

The 0^0 limit takes about 6 s here and past a minute on CI's Windows
runner, whose suite took 19 m 54 s against 7 m; a minute's cap measured
the runner. Before the fix it did not finish in ten minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet
Rafael-SOWNet merged commit f86d0a2 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 a-quotient-whose-powers-grow-is-not-differentiated branch November 4, 2026 00:49
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