Repository navigation
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
Open
Rafael-SOWNet wants to merge 1 commit into
Rafael-SOWNet wants to merge 1 commit into
Conversation
…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 Report❌ Patch coverage is
Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
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-oowas+oowhile its argument2 pi ln|x|keeps turning. The gamma function off the real line turns asIm(z) ln|z|, andgamma(x + i)at+oowas+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 routee^(lim ln H), keep an infinity only for an argument or a logarithm that is real near the point.IsRealNearreads a power or a logarithm of a base positive there (bySignNear), soexp(x^x)andgamma(x^(x/3))stay answered.Checked against mpmath (arg/pi at several scales):
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+ooexp(x + 2 i)at+oo-ooexp(ln(x)^2),gamma(ln(x)),exp(-x ln(x))at-oo+ooexp(ln(x)/x),exp(ln(x)^2),gamma(-ln(x))at 0-+oogamma(ln(ln(x))),exp(1/x + i),gamma(1/x + i)at 0++ooexp((x - 1) ln(x))at 0-+oo-ooexp(-ln(x)/2)at 0-+oo-ooi2^(x + pi i / ln(2))at+oo+oo-oogamma(x + i/x)at+oo+oo(right)exp(ln(x)/x)and two similar, at 0 two-sidedNaNx tanh(ln((1 + 1/x)^x))at -1-1(right)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
+oobecame 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 thetanhrow, 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)andgamma(x) (1 + i)are+oo. That is a complex constant times an infinity, read off bySolveBySubstitution's real-part line, which belongs to #2707.Full unit suite: 22345 passed, 0 failed.
Fixes #2708
🤖 Generated with Claude Code