Repository navigation
Invert a power of the variable in a product l'Hôpital's rule reads at infinity - #2404
Merged
Merged
Conversation
… infinity A product of something vanishing and something diverging is written as a quotient before l'Hopital's rule reads it, the diverging factor on top and the reciprocal of the vanishing one underneath. Where the diverging factor is a power of the variable, that arrangement grows on every step: the reciprocal of the vanishing factor squares it under differentiation, so x^2 * ln(1 - 1 / x) at +oo went to x^3 * ln(1 - 1 / x)^2, then x^4 * ln(1 - 1 / x)^3, for three seconds before answering -oo. The power is inverted instead at an infinity, where its reciprocal is another power that differentiating lowers. A vanishing factor that leaves the reals on the approach keeps the old arrangement. (sqrt(x) - erf(x)) / x at 0 from the left reaches here at +oo with sqrt(-1 / x) in it, and over the power came out a directed complex infinity where it is left unevaluated. Faster, with the same answers: x^2 * ln(1 - 1 / x) at +oo 3.1 s to 0.19 s; (-1 - x) / log(x, 2)^(x - 1) at 1 from the left 6.0 s to 1.6 s, which is 2.6.0's time again; sinh((x - 1)^ln(x)) at 1 from the right 2.0 s to 0.6 s; ln(1 + 1 / x) * ln(1 / x) at +oo 2.1 s to 0.5 s. And some that were declined are answered, because the inverted quotient differentiates to something the rule can read: x^2 * (1 - cos(1 / x)) at +oo is 1/2, x * abs(2 / x) at +oo and -oo is 2 and -2, log(x, x^3 / abs(x)) at 0 from the right is 2, and log(2 * (-1)^x, arcsin(x) / (2 * x)) at 0 is -1, where master said NaN. 2.6.0 answers none of them. tanh(log(arcsin(x), x)) at 0 from the left is slower, 2.8 s to 6.7 s, same answer (2.6.0 declines it after 11 s): x^3 * arccsc(-x) inside it is now differentiated, and the caller declines the result. Only inverting where the old arrangement would differentiate too gave that time back, and lost x^2 * (1 - cos(1 / x)). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2404 +/- ##
==========================================
- Coverage 86.81% 86.81% -0.01%
==========================================
Files 312 312
Lines 69339 69342 +3
Branches 20235 20237 +2
==========================================
+ Hits 60195 60197 +2
- Misses 4917 4919 +2
+ Partials 4227 4226 -1
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.
Before l'Hôpital's rule reads a product of a vanishing factor and a diverging one, the product is rewritten as a quotient: the diverging factor goes on top and the reciprocal of the vanishing one underneath.
When the diverging factor is a power of the variable, each differentiation makes that quotient bigger.
x^2 * ln(1 - 1/x)at +oo went tox^3 * ln(1 - 1/x)^2, then tox^4 * ln(1 - 1/x)^3, for three seconds. At an infinite destination the power is now inverted instead. Its reciprocal is another power, which differentiation lowers. The fix is inAsQuotientOfVanishingAndDiverginginTransformations.cs.A vanishing factor that leaves the reals on the approach keeps the old arrangement. Otherwise
(sqrt(x) - erf(x)) / xat 0 from the left answers a directed complex infinity, where master leaves it unevaluated.Faster, same answers:
x^2 * ln(1 - 1/x)at +oo(-1 - x) / log(x, 2)^(x - 1)at 1, leftsinh((x - 1)^ln(x))at 1, rightln(1 + 1/x) * ln(1/x)at +oosin(x/2) / log(x, pi)^(x - 1)at 1, leftAnswered, where master declines:
x^2 * (1 - cos(1/x))at +oox * abs(2/x)at +oo, -oolog(abs(-1/x), x)at +oolog(x, x^3 / abs(x))at 0, rightlog(tanh(sin(x)), arcsin(x)/x)at 0sinh(arctan(x))^sqrt(x*x)at 0, lefterf(e^x) * x * iat -oolog(2 * (-1)^x, arcsin(x) / (2x))at 02.6.0 answers none of these, so no answer changes against it and there is no BREAKING-CHANGES entry.
Slower:
tanh(log(arcsin(x), x))at 0 from the left (and two-sided) goes from 2.8 s to 6.7 s, with the same answer; 2.6.0 declines it after 11 s.x^3 * arccsc(-x)at +oo is now differentiated and reaches -oo, and its caller declines anyway.x^2 * (1 - cos(1/x)). An answer seemed worth more than the time.x * arccsc(-x)at +oo (-1) is declined at the top level on master and here.The calculus tests pass, and so do the full suite (19235), the MCP, terminal, interactive and F# suites, the AOT build and every harness. limitcheck against master over all seeds shows only the rows above.
New test:
APowerOfTheVariableIsInvertedTest.🤖 Generated with Claude Code