Skip to content

Leave a two-sided limit unevaluated where a side is undecided off the reals (#2667) - #2670

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
undecided-quotient-is-not-nan-2667
Nov 30, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
undecided-quotient-is-not-nan-2667

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

(abs(a + x) - abs(a)) / x at 0 was NaN, which claims the limit does not exist. The limit is sgn(a) for every real a other than 0.

Cause. Each side alone stops at 0 / 0 and is left unevaluated, because the derivative of abs(a + x) is not taken while a may be complex. WhereBothSidesAgree returns at once for an expression not shown to be real on both sides. So the undecided sides were never seen, and the NaN stood.

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:

  • it stops at a form with an infinity in it, as it already did for real functions;
  • it stops at 0 / 0 itself, 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 master / 2.10.0 this branch
(abs(a + x) - abs(a)) / x at 0 NaN unevaluated
(abs(x) - abs(a)) / (x - a) at a NaN unevaluated
(abs(a + x) - abs(a)) * x^(-1) at 0 NaN unevaluated
(x - x) / (x - x), ln(-2) / ln(x) at 1, x^i at 0 NaN NaN (unchanged)
abs(x) / x, 1 / x, sin(1 / x) at 0, tan(x) at pi/2 NaN NaN (unchanged)

A first version withheld the NaN at the outermost call wherever a side was undecided. That turned eight pinned NaNs, for limits that genuinely do not exist, into unevaluated ones, so I replaced it.

Checks

  • The new test AnUndecidedSideIsNotADisagreementTest pins the abs quotients through the two-argument overload, the overload that names the side, and Simplify of the limit node. It also pins the NaNs that stay.
  • The full UnitTests suite passed: 21895 passed, 13 skipped, 0 failed. The library builds for every target framework.
  • limitcheck reports the same findings as lc-wtmaster2620.
  • symlimitcheck: the 10 abs rows move from "NaN where the values settle" to refused. No other row changes beyond those this branch's base already fixes.

Cost. Simplify of the abs limit node now takes about 4 s (0.5 s on master). It asks the sides of each candidate before declining.

.editorconfig gains one entry: the 2026 header template for the new test file, which IDE0073 requires.

Fixes #2667.

🤖 Generated with Claude Code

… 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

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.72%. Comparing base (cc86a04) to head (ecaf081).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 65.00% 2 Missing and 5 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.21% <65.00%> (+0.01%) ⬆️
fsharp 32.79% <ø> (ø)
interactive 40.09% <ø> (ø)

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.80% <65.00%> (-1.42%) ⬇️

... and 19 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 97f26c6 into master Nov 30, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 30, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the undecided-quotient-is-not-nan-2667 branch November 30, 2026 03:16
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.

The difference quotient of abs at a symbolic point is NaN: an undecided 0/0 is returned as the limit

1 participant