Skip to content

Cancel any factor written on both sides of a l'Hopital quotient - #2378

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/indeterminate-power-sinh
Nov 7, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/indeterminate-power-sinh

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

l'Hopital's rule turns ln(sinh(x)^3) into a quotient with (e^x - e^(-x))^2 above and (e^x - e^(-x))^3 below. #2377 divides out a factor written on both sides, but only a polynomial one, so this shared factor was differentiated with everything else until the rule's budget ran out. (sinh(x)^3)^tan(x) at 0 was left unevaluated from each side, where it is 1. 2.6.0 answered NaN.

A factor that is not a polynomial is now cancelled the same way, on two conditions:

  • It is built from functions analytic where they are defined. Then, if it is not 0 everywhere, its zeros fill no interval, and where the cancelled quotient has a limit the original has the same one. An abs, a sign, a step or a piecewise can be 0 on one side only, as abs(x) - x is, so a factor holding one is not cancelled.
  • It is plainly not 0 at a sample point, more than 1/1000 in modulus at 7/3 or -11/5. sin(x)^2 + cos(x)^2 - 1 is 0 but may evaluate to a rounding error, and it is not cancelled.
Input, at 0 2.6.0 master This PR
(sinh(x)^3) ^ tan(x), from the left NaN unevaluated 1
(sinh(x)^3) ^ tan(x), from the right NaN unevaluated 1
x / cos(x) * ln(sinh(x)^3), from the right NaN unevaluated 0
sin(x) / cos(x) * ln((e^x - 1)^3), from the right NaN unevaluated 0

The two-sided limit of the first stays NaN. The base is negative on the left, so the power takes the complex branch there, and the two-sided convention for that is #2365's open question.

Measured

  • Suite, wrappers, AOT and the harnesses are green.
  • limitcheck at DEPTH=3, across 39 seeds against master: two more limits answered at SEED=62, both agreeing with the values, and nothing else moved.

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

🤖 Generated with Claude Code

l'Hopital's rule turns ln(sinh(x)^3) into a quotient with
(e^x - e^(-x))^2 above and (e^x - e^(-x))^3 below, and the shared
factor was differentiated with everything else until the budget ran
out: (sinh(x)^3)^tan(x) at 0, which is 1, was unevaluated from each
side, and NaN in 2.6.0.

A factor that is not a polynomial is now divided out where it is
built from functions analytic where they are defined -- no abs, sign,
step or piecewise, which can be 0 on one side only -- and is plainly
not 0 at a sample point, so an identity that evaluates to a rounding
error is not cancelled. Such a factor's zeros fill no interval, so
where the cancelled quotient has a limit the original has the same.

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

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.76%. Comparing base (d205f72) to head (a4e9878).

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2378      +/-   ##
==========================================
- Coverage   86.77%   86.76%   -0.02%     
==========================================
  Files         312      312              
  Lines       69033    69036       +3     
  Branches    20133    20134       +1     
==========================================
- Hits        59906    59898       -8     
- Misses       4918     4928      +10     
- Partials     4209     4210       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.30% <66.66%> (-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.36% <66.66%> (-0.25%) ⬇️

... 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 68c41bf into master Nov 7, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 7, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/indeterminate-power-sinh branch November 7, 2026 03:55
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