Repository navigation
Keep the correction to (1 + u)^(1/u) where a growing factor multiplies it - #2719
Merged
Merged
Conversation
…s it (1 + u)^(1/u) tends to e with an error of order u, and two readings put e in its place where that error mattered. The second remarkable limit rewrote every 1^oo power inside the expression, not only the expression itself. f^g -> e^(g (f - 1)) keeps the limit of the power alone, since the two exponents agree to a factor tending to 1, but not the error, so (e - (1 + 1/x)^x) x at +oo became (e - e) x and was 0 where it is e/2. It now rewrites only the whole expression whose limit is asked; a power inside it is taken by the descent, which asks the power's own limit and reads 0 * oo as indeterminate. Gruntz's algorithm read a constant term its series had not been carried far enough to see as 0. x^2 ln(1 + 1/x) - x asked to w^2 comes back known only to w^0 once its w^(-1) terms cancel, and Exponentiate took the missing w^0 term for 0, so (1 + 1/x)^(x^2) / e^x at +oo was 1 where it is e^(-1/2). Exponentiate and Through now decline a series that does not know its constant; they, Logarithm, Invert and the binomial series no longer claim an order past what their input knows; and the exponent, the argument of an analytic function, a divisor and a logarithm's argument are expanded further where the result falls short. Rewriting only the whole expression took away the reading that answered the floor of a power tending to e, which the evaluation at 10^6 cannot sample as real; the step functions now also ask IsRealOnTheApproach, which reads it by structure. All 52 rows of the sweep that found this, and 134 variants of them, are right against mpmath; of 6314 sweep limits, 78 change, every one to a right answer, and none get slower. Fixes #2706 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2719 +/- ##
==========================================
+ Coverage 86.65% 86.67% +0.01%
==========================================
Files 346 346
Lines 76959 76960 +1
Branches 22644 22644
==========================================
+ Hits 66692 66707 +15
+ Misses 5534 5530 -4
+ Partials 4733 4723 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
(1 + u)^(1/u)tends toewith an error of orderu, and two readings putein its place where that error mattered.1^oopower inside the expression.f^g -> e^(g (f - 1))keeps the limit of the power alone, not its error, so(e - (1 + 1/x)^x) xat+oowas(e - e) x = 0(truee/2). It now rewrites only the whole expression; a power inside it is left to the descent.x^2 ln(1 + 1/x) - xasked tow^2is known only tow^0once itsw^(-1)terms cancel, andExponentiatetook the missing constant for 0:(1 + 1/x)^(x^2) / e^xat+oowas1(truee^(-1/2)).ExponentiateandThroughnow decline a series that does not know its constant; they,Logarithm,Invertand the binomial series no longer claim an order past their input's; and the exponent, an analytic function's argument, a divisor and a logarithm's argument are expanded further where the result falls short.floor((1 + 1/x)^x)at+oohad been answered only through the first rewrite; the step functions now also read realness by structure (IsRealOnTheApproach), and it stays2.Measured against mpmath (80-200 digits):
409d68805(1 + 1/x)^(x^2) / exp(x)at±oo1e^(-1/2)(e - (1 + 1/x)^x) xat+oo0e/2x ((1 + 1/x)^x - e)at+oo0-e/2((1 + x)^(1/x) - e) / xat 00-e/2(1 + x)^(1/x^2) / exp(1/x)at 01e^(-1/2)(1 + x + x^2)^(1/x^2) / exp(1/x)at 0ee^(1/2)(1 + x)^(1/x^3) / exp(1/x^2 - 1/(2x))at 0+ / 0-+oo/0e^(1/3)(1 + x)^(1/x^2) (1 - x)^(1/x^2)at 01e^(-1)cos(x)^(1/x^4) exp(1/(2 x^2))at 0e^(-1/12)sin/tan/cosbases, second-order corrections, products and differences of such powers): 128 right, 6 unevaluated, 0 wrong. Master: 42 wrong and 36 that mpmath flags as suspect.(Shi(x) - x) / x^3at 0+ =1/18.xin the exponent, run on both builds at the same time and the same load, took 102.7 s on master and 98.2 s here, over the rows whose answers agree. No row got more than 2x + 200 ms slower.1 / log(x^2, cos(x))at 0 is now+oo, so it moves fromAnUndecidedSideLeavesTheLimitUnevaluatedTestinto the new test class.Every changed answer is recorded in
BREAKING-CHANGES.md.Fixes #2706
🤖 Generated with Claude Code