Repository navigation
Leave a two-sided limit unevaluated where a side is undecided off the reals (#2667) - #2670
Merged
Merged
Conversation
… reals (#2667) (abs(a + x) - abs(a)) / x at 0 was NaN, the claim that it has no limit, where it is sgn(a) for every real a other than 0. Each side alone stops at 0 / 0 and is left unevaluated, since the derivative of abs(a + x) is not taken while a may be complex. WhereBothSidesAgree returned at once for an expression not shown real on both sides, so the undecided sides were never seen and the NaN stood. The sides are now asked off the real functions too, for whether one is undecided; agreement is still promoted to an answer only for real-valued functions. A side is undecided off the reals where it stops at a form with an infinity in it, as on them, or at 0 / 0 itself where the expression has a value beside the point with its other symbols read as one generic number. (x - x) / (x - x), ln(-2) / ln(x) at 1 and x^i at 0 keep their NaN. A first version withheld the NaN at the outermost call instead, wherever a side was undecided; it turned eight pinned NaNs of limits that do not exist into unevaluated ones, and was replaced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2670 +/- ##
==========================================
+ Coverage 86.70% 86.72% +0.01%
==========================================
Files 346 346
Lines 75739 75867 +128
Branches 22152 22207 +55
==========================================
+ Hits 65671 65793 +122
Misses 5431 5431
- Partials 4637 4643 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(abs(a + x) - abs(a)) / xat 0 wasNaN, which claims the limit does not exist. The limit issgn(a)for every realaother than 0.Cause. Each side alone stops at
0 / 0and is left unevaluated, because the derivative ofabs(a + x)is not taken whileamay be complex.WhereBothSidesAgreereturns at once for an expression not shown to be real on both sides. So the undecided sides were never seen, and theNaNstood.Fix. The sides are now asked off the real functions too, but only to learn whether one of them is undecided. Agreement between the sides is still promoted to an answer only for real-valued functions. Off the reals, a side counts as undecided in two cases:
0 / 0itself, and the expression has a value beside the point when its other symbols are read as one generic number..Limit(x, ...),.Simplify()of the node(abs(a + x) - abs(a)) / xat 0NaN(abs(x) - abs(a)) / (x - a)ataNaN(abs(a + x) - abs(a)) * x^(-1)at 0NaN(x - x) / (x - x),ln(-2) / ln(x)at 1,x^iat 0NaNNaN(unchanged)abs(x) / x,1 / x,sin(1 / x)at 0,tan(x)atpi/2NaNNaN(unchanged)A first version withheld the
NaNat the outermost call wherever a side was undecided. That turned eight pinnedNaNs, for limits that genuinely do not exist, into unevaluated ones, so I replaced it.Checks
AnUndecidedSideIsNotADisagreementTestpins the abs quotients through the two-argument overload, the overload that names the side, andSimplifyof the limit node. It also pins theNaNs that stay.lc-wtmaster2620.Cost.
Simplifyof the abs limit node now takes about 4 s (0.5 s on master). It asks the sides of each candidate before declining..editorconfiggains one entry: the 2026 header template for the new test file, which IDE0073 requires.Fixes #2667.
🤖 Generated with Claude Code