Skip to content

Read a limit that is a constant minus itself as 0 (#2628) - #2632

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
difference-quotient-at-a-symbolic-point-2628
Nov 28, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
difference-quotient-at-a-symbolic-point-2628

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

The limit of a difference quotient at a symbolic point was NaN, which claims the limit does not exist. Each of these is a textbook derivative.

Cause. The numerator's limit came back as e^a - e^a. The inner simplification leaves that as written, so nothing read it as 0. The quotient was then taken for a nonzero constant over a vanishing divisor, which diverges with opposite signs on the two sides.

Fix. LimitFunctional.CancelledDifference turns a limit that is one finite constant minus itself into 0. Where the constant has a domain condition, the 0 carries it, as Simplify already does for ln(a) - ln(a). It is applied to every limit ComputeLimit returns and to both descent results in Minusf.

.Limit(x, ...) master / 2.10.0 this branch
(e^(a + x) - e^a) / x at 0 NaN e ^ a
(sin(a + x) - sin(a)) / x at 0 NaN cos(a)
(ln(a + x) - ln(a)) / x at 0 NaN 1 / a
(sqrt(a + x) - sqrt(a)) / x at 0 NaN a ^ (-1/2) / 2
((a + x)^(1/3) - a^(1/3)) / x at 0 NaN a ^ (-2/3) / 3
(sqrt(x) - sqrt(b)) / (x - b) at b NaN b ^ (-1/2) / 2
ln(a + x) - ln(a) at 0 ln(a) - ln(a) 0 provided not a = 0

Checks

  • The new test ADifferenceQuotientAtASymbolicPointTest takes each limit from both sides and from each side alone. It requires an answer that is not NaN, and compares it by value with the derivative at three values of a.
  • limitcheck reports the same findings on this branch as on master: 0 wrong values, and 7 NaNs that are all the x^x family (a policy question).
  • I re-ran a hand sweep of 76 one-sided limits at branch points and poles, plus 50 answers containing ln. No answer differs from current master.
  • The full UnitTests suite passed: 21759 passed, 13 skipped, 0 failed. The library builds for every target framework.

.editorconfig gains one entry: the 2026 header template for the new test file, which IDE0073 requires. The breaking-changes entry is under Unreleased.

Closes #2628.

🤖 Generated with Claude Code

The limit of (e^(a + x) - e^a) / x at 0 was NaN, the claim that it has no
limit, and so were the difference quotients of sqrt, sin, ln and cube roots at
a symbolic point. The numerator's limit came back as e^a - e^a, which the inner
simplification leaves written; nothing read it as 0, so the quotient was taken
for a constant over a vanishing divisor, whose two sides disagree.

LimitFunctional.CancelledDifference turns a limit that is one finite constant
minus itself into 0, with the constant's domain condition where it has one, as
Simplify does for ln(a) - ln(a). It is applied to every limit ComputeLimit
returns and to both of Minusf's descent results. The two sides are compared
inner-simplified as well: for the difference of logarithms the two terms
print alike as ln(a) and are not the same tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.70%. Comparing base (fc8aaf4) to head (a60a525).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2632      +/-   ##
==========================================
- Coverage   86.72%   86.70%   -0.03%     
==========================================
  Files         345      345              
  Lines       75366    75445      +79     
  Branches    22026    22042      +16     
==========================================
+ Hits        65360    65413      +53     
- Misses       5400     5419      +19     
- Partials     4606     4613       +7     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.20% <100.00%> (-0.03%) ⬇️
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 Δ
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 78.54% <100.00%> (+0.08%) ⬆️
...ns/Continuous/Limits/Solvers/Solvers.Definition.cs 92.08% <100.00%> (+0.20%) ⬆️

... 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.

@Rafael-SOWNet
Rafael-SOWNet merged commit a1b69bf into master Nov 28, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 28, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the difference-quotient-at-a-symbolic-point-2628 branch November 28, 2026 21:15
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 limit of a difference quotient at a symbolic point is NaN: (e^(a+x) - e^a)/x at 0

1 participant