Skip to content

A limit on a logarithm's cut is not read off the principal value - #2294

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-limit-on-a-branch-cut-is-not-read-off-the-principal-value
Oct 31, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-limit-on-a-branch-cut-is-not-read-off-the-principal-value

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

limitright(ln(x^x), x, -1) was ln(-1), which is i pi, where the limit is -i pi. As x comes down to -1, x^x comes to -1 from below the cut, and the principal logarithm is continuous on its cut from above only. Its value there is the limit along the real line and from above, and it was given as the limit from either side.

ArrivesOnTheCutOffTheRealLine asks whether a logarithm's argument, or the base of a power to an exponent that is not whole, tends to a negative real without being known to arrive there along the real line. A power's base and a logarithm's argument count as positive where their values at the destination are positive. This PR does not decide which side such an argument comes from, so a limit there is declined, wherever it was read: in substitution, the logarithm's and the power's descent, SolveAsLogarithm, the quotient of logarithms, and Gruntz, whose series took the principal logarithm of a negative coefficient.

Input 2.6.0 and master Now
limitright(ln(x^x), x, -1) ln(-1), which is i pi unevaluated; the limit is -i pi
limit(ln(x^x), x, -1) ln(-1) unevaluated; there is no limit
limitleft(ln(-1 + i*x), x, 0) ln(-1) unevaluated; the limit is -i pi
limitright(sqrt(x^x), x, -1) i unevaluated; the limit is -i
limitleft(ln(x^x), x, -1) ln(-1), which is right unevaluated

Two costs:

  • A limit from above is declined too, though its answer was right (the last row). Keeping those answers needs the side decided. For a logarithm, sampling the imaginary part could decide it. For (-1 + i x)^(1/3) it would not help, because this library's value of a cube root on the negative axis is the real root, not the principal one.
  • A decline can be slow under Simplify. limitright(ln(x^x) / x, x, -1) takes 6.9 s, where master answered it wrongly in 44 ms. InnerSimplified declines in 0.4 s, and the rest is Simplify asking every candidate form again.

LimitOnABranchCutTest: 11 of its cases fail on master, and the 9 along the real line pass on both. The suite (18,366), the trio, F#, AOT and the eight harnesses pass locally on the rebased branch. Composed with #2268, #2275 and #2276, work/limitcheck no longer finds any of the 56 limits that master answered with a different value, out of 600 expressions.

#2278 removed the stack overflow this change first ran into.

Part of #2266.

🤖 Generated with Claude Code

limitright(ln(x^x), x, -1) was ln(-1), which is i pi, where it is
-i pi: x^x comes to -1 from below as x comes down to -1, and the
principal logarithm is continuous on its cut from above only. The
value on the cut is the limit along the real line and from above, so
it was given as the limit from either side.

ArrivesOnTheCutOffTheRealLine asks whether a logarithm's argument, or
the base of a power to an exponent that is not whole, tends to a
negative real and is not known to be real on the approach; a power's
base and a logarithm's argument count as positive where their values
at the destination are. Which side such an argument comes from is not
decided, so a limit there is declined: by substitution, by the
logarithm's and the power's descent, by SolveAsLogarithm, by the
quotient of logarithms, and by Gruntz, whose series took the principal
logarithm of a negative coefficient. A limit from above, whose answer
was right, is declined too.

LimitOnABranchCutTest takes eight limits from below the cut, three
two-sided ones that do not exist, and nine along the real line, which
are answered as before; eleven fail on master. The suite, the trio,
F#, AOT and the eight harnesses pass. Composed with #2268, #2275 and
#2276, work/limitcheck finds none of the 56 limits it found answered
with another value on master, of 600 expressions.

Part of #2266.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 31, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 31, 2026
@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.16667% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.70%. Comparing base (6cabd96) to head (74db309).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ath/Functions/Continuous/Limits/Transformations.cs 75.86% 3 Missing and 4 partials ⚠️
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 75.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2294      +/-   ##
==========================================
- Coverage   86.71%   86.70%   -0.02%     
==========================================
  Files         310      310              
  Lines       67873    67918      +45     
  Branches    19703    19724      +21     
==========================================
+ Hits        58858    58889      +31     
- Misses       4891     4901      +10     
- Partials     4124     4128       +4     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.25% <79.16%> (-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 Δ
...iMath/Functions/Continuous/Limits/Gruntz/Gruntz.cs 77.57% <100.00%> (+0.27%) ⬆️
...nctions/Continuous/Limits/Solvers/Limit.Solvers.cs 85.71% <100.00%> (+0.50%) ⬆️
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 71.49% <75.00%> (+0.73%) ⬆️
...ath/Functions/Continuous/Limits/Transformations.cs 87.52% <75.86%> (-0.26%) ⬇️

... 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 2c9dceb into master Oct 31, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 31, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-limit-on-a-branch-cut-is-not-read-off-the-principal-value branch October 31, 2026 05:17
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