Skip to content

Leave a limit whose phase keeps turning unevaluated: exp off the real line, and gamma along a complex path - #2729

Open
Rafael-SOWNet wants to merge 1 commit into
masterfrom
fix-2708-turning-phase-declines
Open

Rafael-SOWNet wants to merge 1 commit into
masterfrom
fix-2708-turning-phase-declines

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A constant to a growing power was read through its exponent's limit, which gives how the modulus grows and nothing about the argument. exp(ln(x)^2) at -oo was +oo while its argument 2 pi ln|x| keeps turning. The gamma function off the real line turns as Im(z) ln|z|, and gamma(x + i) at +oo was +oo.

  • Powf's descent keeps an infinity for a positive constant base only where the argument settles on an axis. That means the exponent is real near the point, or what is left of it after its real addends has a finite limit (exp(x + pi i) is still -oo).
  • Factorialf's descent, and the Stirling route e^(lim ln H), keep an infinity only for an argument or a logarithm that is real near the point.
  • A new structural IsRealNear reads a power or a logarithm of a base positive there (by SignNear), so exp(x^x) and gamma(x^(x/3)) stay answered.

Checked against mpmath (arg/pi at several scales):

limit master now
exp((1 + i) x), exp(x + i), exp(x + i ln(x)), 2^(x + i), gamma(x + i), gamma(x + i ln(x)) at +oo +oo unevaluated
exp(x + 2 i) at +oo -oo unevaluated
exp(ln(x)^2), gamma(ln(x)), exp(-x ln(x)) at -oo +oo unevaluated
exp(ln(x)/x), exp(ln(x)^2), gamma(-ln(x)) at 0- +oo unevaluated
gamma(ln(ln(x))), exp(1/x + i), gamma(1/x + i) at 0+ +oo unevaluated
exp((x - 1) ln(x)) at 0- +oo -oo
exp(-ln(x)/2) at 0- +oo -ooi
2^(x + pi i / ln(2)) at +oo +oo -oo
gamma(x + i/x) at +oo +oo (right) unevaluated
exp(ln(x)/x) and two similar, at 0 two-sided NaN unevaluated
x tanh(ln((1 + 1/x)^x)) at -1 -1 (right) unevaluated

exp(x + pi i), exp(x + i/x), gamma(x), and the #2697 directions (ln(x), sqrt(x)/x, x^(x - 1), x^(x - 2) at 0-) are unchanged.

In the 6314-limit sweep, 18 answers changed: 14 wrong +oo became unevaluated, and so did the 4 last rows above. Total probe time was 607 s on master and 555 s here. The one slower row is the tanh row, which now declines in 4 to 5 s where master answered it in 0.1 to 0.7 s.

Still wrong and left alone: exp(1/x) (1 + i) and gamma(x) (1 + i) are +oo. That is a complex constant times an infinity, read off by SolveBySubstitution's real-part line, which belongs to #2707.

Full unit suite: 22345 passed, 0 failed.

Fixes #2708

🤖 Generated with Claude Code

…nt off the real line, and gamma along a path off it

A constant to a power whose exponent grows was read through the exponent's limit, and an infinite one gave an
infinity: ln(x)^2 at -oo is +oo, rightly, and exp(ln(x)^2) there was +oo where its argument 2 pi ln|x| keeps
turning. The modulus of b^g is e^Re(g ln b) and its argument Im(g ln b), so the exponent's limit says nothing about
the direction. Powf's descent now keeps an infinity for a positive constant base only where the argument settles on
an axis: the exponent is real near the point, or what is left once its addends real there are taken out has a finite
limit, as pi i in exp(x + pi i), which is -oo. Otherwise it declines, and the routes after it answer where they can:
exp((x - 1) ln(x)) at 0 from the left is now -oo, and exp(-ln(x)/2) there -ooi, both +oo before.

The gamma function along a path off the real line turns as Im(z) ln|z| by Stirling's formula, so the factorial's
descent keeps an infinity only for an argument real near the point, and the Stirling route that answers e^(lim ln H)
keeps an infinite one only where the logarithm is real: gamma(x + i) at +oo and gamma(ln(x)) at -oo were +oo.

Realness near the point is decided structurally by a new IsRealNear: a power or a logarithm of a base positive there
by SignNear, which keeps exp(x^x) and gamma(x^(x/3)) at +oo answered. Of the 6314 limits of the sweep that found
this, 18 answers changed: 14 wrong +oo are unevaluated, and so are three two-sided NaN with one turning side and
x tanh(ln((1 + 1/x)^x)) at -1, which needed only the modulus.

Fixes #2708

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.54902% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.67%. Comparing base (409d688) to head (7a2515e).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 70.83% 6 Missing and 8 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2729      +/-   ##
==========================================
+ Coverage   86.65%   86.67%   +0.01%     
==========================================
  Files         346      346              
  Lines       76959    77021      +62     
  Branches    22644    22671      +27     
==========================================
+ Hits        66692    66759      +67     
+ Misses       5534     5527       -7     
- Partials     4733     4735       +2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.16% <72.54%> (+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 Δ
...ath/Functions/Continuous/Limits/Transformations.cs 90.13% <100.00%> (+0.01%) ⬆️
...nctions/Continuous/Limits/Solvers/Limit.Classes.cs 79.69% <70.83%> (-0.79%) ⬇️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

A limit whose phase keeps turning is answered +oo: exp((1 + i) x) at +oo, exp(ln(x)^2) at -oo, gamma(x + i) at +oo

1 participant