Skip to content

Take no undecided limit for an infinite one in l'Hôpital's rule - #2360

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix/left-limit-of-a-continuous-composition
Nov 4, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
fix/left-limit-of-a-continuous-composition

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

tan(x^2 + x - 1) from the left at 0 answered -cos(-1) / sin(-1), which is 0.642. The limit is tan(-1), which is -1.557. 2.6.0 gives the same wrong answer.

Whether a limit diverges was read off whether an infinity occurs in it. An unevaluated limit(sin(u), x, +oo) contains one, as its destination. So l'Hôpital's rule took sin(u) / cos(u), with neither part's limit taken, for oo/oo and differentiated it. The rule, and the two places that build its quotients, now ask DivergesDecidedly, which turns an undecided limit away. The rewrites that ask IsInfiniteNode only to decide whether to try are unchanged, because they are equalities wherever they apply.

Two answers had been reached through the same mistake, and are now reached properly:

  • A side asked at a real infinity is now the two-sided limit. An infinity has one side. The Stirling limits read -x + ln(2 pi x)/2 at +oo from the left, unevaluated, as infinite, which it happens to be. This also answers x - sqrt(x^2 + x) at +oo (-1/2) and e^x x at -oo (0).
  • A power whose base tends to a non-zero number and whose exponent tends to 0 is 1. log(x, tanh(x))^(x^(pi + x)) at 0+ had been answered only while its base came back undecided.

limitcheck, DEPTH=3, seeds 14, 16, 19, 23 and 26, against master 37f7377:

master this branch
the limit is another value 11 6
compared 25 961 25 958
the limit did not finish in 5 s 1 1

The five wrong values removed are all now unevaluated, and one limit more is answered (seed 23). One of those five was a right answer on 2.6.0: log(x^x, 3/2) - 1 from the left at -1 is -1 - 0.129 i, and earlier 2.7.0 changes had already turned it into -1. It is recorded in BREAKING-CHANGES.md with the rest. Suite, AOT and the harnesses are green locally.

Found by limitcheck at SEED=26; no issue was filed.

🤖 Generated with Claude Code

Whether a limit diverges was read off whether an infinity occurs in it, and
an unevaluated limit(sin(u), x, +oo) holds one, as its destination. So
l'Hopital's rule took sin(u) / cos(u), with neither part's limit taken, for
oo/oo and differentiated it: tan(x^2 + x - 1) from the left at 0 answered
-cos(-1) / sin(-1), 0.642, where the limit is tan(-1), -1.557. The same on
2.6.0. The rule, and the two places that build its quotients, now ask
DivergesDecidedly, which turns an undecided limit away. The rewrites that
ask IsInfiniteNode only whether they are worth trying keep it: f^g as
e^(g ln f) is an equality whatever f does.

Two answers had been reached through the mistake. The Stirling limits read
-x + ln(2 pi x)/2 at +oo, asked from the left, unevaluated, as infinite --
which it is. An infinity has only one side and the one-sided path lacks the
machinery the two-sided one has there, so a side asked for at a real
infinity is now the two-sided limit; that also answers x - sqrt(x^2 + x) at
+oo, -1/2, and e^x x at -oo, 0, both unevaluated before. And
log(x, tanh(x))^(x^(pi + x)) at 0+ was 1 only because its base came back
undecided; decided, it tends to 1 and the exponent to 0. A power whose base
tends to a number other than 0 and whose exponent tends to 0 now answers 1.

limitcheck, DEPTH=3, seeds 14, 16, 19, 23, 26 against master 37f7377:
the limit is another value 11 -> 6, each of the five now unevaluated,
and one limit more answered. Found at SEED=26; no issue was filed.

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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.77%. Comparing base (37f7377) to head (7171eb0).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2360      +/-   ##
==========================================
- Coverage   86.78%   86.77%   -0.01%     
==========================================
  Files         312      312              
  Lines       68809    68815       +6     
  Branches    20045    20048       +3     
==========================================
+ Hits        59713    59714       +1     
- Misses       4911     4918       +7     
+ Partials     4185     4183       -2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.31% <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 Δ
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 90.95% <100.00%> (+0.09%) ⬆️
...ath/Functions/Continuous/Limits/Transformations.cs 88.28% <100.00%> (+0.42%) ⬆️

... 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 f73ac9a 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 fix/left-limit-of-a-continuous-composition branch November 4, 2026 04:32
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