Repository navigation
Do not take an exponential of the variable out of the linears recurrence as a constant - #2741
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
…nce as a constant SolveANegativePowerOfALinearBesideAPowerOfAnotherByTheRecurrence moved every factor whose base is free of the variable into its constant before looking at the exponent, so e^x, 2^x and e^(-1/x) were taken out of the integral: e^x/(x^2 sqrt(1 + x)) was answered as e^x times the antiderivative of 1/(x^2 sqrt(1 + x)). The check that an exponent holds the variable came after, and never ran for a constant base. Below integration by parts and the reciprocal substitution, the remainder of e^(-x) arsinh(sqrt(x)) reaches e^(-1/u) (1 + u)^(-1/2)/u^2, and the wrong answer for it made the whole antiderivative a constant: its derivative is 0, and the definite integral was 0 on every interval, with exp(x), exp(-2x), arsinh(sqrt(2x)), arcosh(sqrt(x + 1)) and ln(sqrt(x + a) + sqrt(x)) alike. The exponent is now read first, and a factor with the variable in its exponent declines the rule, as one with a variable base already did. These integrals are not elementary (the remainder is an incomplete Bessel-type integral), so they are left unevaluated; the issue's own definite integral searches 35 s before it declines, against 7 s for the wrong 0. Every row of 24 generated variants is right or unevaluated against mpmath's quadrature, where 18 were wrong. Fixes #2717 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 #2741 +/- ##
==========================================
+ Coverage 86.65% 86.73% +0.07%
==========================================
Files 346 346
Lines 76959 76972 +13
Branches 22644 22648 +4
==========================================
+ Hits 66692 66759 +67
+ Misses 5534 5513 -21
+ Partials 4733 4700 -33
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.
The recurrence for a negative whole power of a linear beside a power of another (
SolveANegativePowerOfALinearBesideAPowerOfAnotherByTheRecurrence) moved every factor with a constant base into its constant before it looked at the exponent. Soe^x,2^xande^(-1/x)were taken out of the integral, ande^x/(x^2 sqrt(1 + x))was answered ase^xtimes the antiderivative of1/(x^2 sqrt(1 + x)).How #2717 reaches it. By parts, then the substitution
u = 1/sqrt(x)andw = u^2, the remainder ofe^(-x) arsinh(sqrt(x))reachese^(-1/w) (1 + w)^(-1/2)/w^2. The wrong answer for that made the whole antiderivative a constant: its derivative is 0, so the definite integral was0on every interval. Traced at the dispatcher. The fix reads the exponent first, so a factor with the variable in its exponent declines the rule, as a variable base already did. These integrals are not elementary: the remainder∫ e^(-x)/(2 sqrt(x) sqrt(x + 1))is an incomplete Bessel-type integral. So they are left unevaluated.Variants against mpmath
quad(dps 30),simplify(integral(f, x, a, b)), master409d68805against this branch:exp(-x)*arsinh(sqrt(x))0exp(-x)*arsinh(sqrt(x))0exp(-x)*arsinh(sqrt(x))0exp(x)*arsinh(sqrt(x))0exp(-2*x)*arsinh(sqrt(x))0exp(3*x)*arsinh(sqrt(x))0exp(-x)*arsinh(sqrt(2*x))0exp(-x)*arsinh(sqrt(x/3))0exp(-x)*arcosh(sqrt(x+1))0exp(-x)*ln(sqrt(x+1)+sqrt(x))0exp(-x)*ln(sqrt(x+2)+sqrt(x))exp(-x)*ln(sqrt(x+3)+sqrt(x))exp(-x)*ln(sqrt(x+1/2)+sqrt(x))exp(x)/(x^2*sqrt(1+x))2^x/((x+1)^3*sqrt(x+2))exp(-1/x)/(x^2*sqrt(1+x))exp(x)*x/((x+1)^2*sqrt(x))exp(-x)/(x^2*sqrt(x+1))exp(x)*(x+2)/((x+1)^2*sqrt(x+3))x*arsinh(sqrt(x)),1/(x^2*sqrt(1+x)),x^2/((x+1)^3*sqrt(x+2))exp(-x)*ln(1+sqrt(x)),exp(-x)*arsinh(x)Master had 18 wrong answers here. This branch has none.
Cost. A decline searches longer than the wrong answer did. Taking the variable out early had cut the search short. The direct shapes take 0.7 to 5.4 s, where master took about 0.6 s. The
arsinh(sqrt(x))definite integrals do not return within the probe's 20 s. The issue's row, timed without a cap, took 35 s where the wrong0took 7.4 s. The indefiniteexp(-x)*ln(sqrt(x+1)+sqrt(x))takes 12.9 s, where master took 1.8 s. That is slower, but no longer wrong. Bounding that search is separate work.Measured. Full unit suite: 22332 passed, 0 failed. F# wrapper: 135 passed. CasBench: 120/121 with 0 wrong, the same list as master. PropCheck: 1355 checks with 0 failures, the same as master. The integration and corpus tests on master: 3704 passed. BREAKING-CHANGES.md has an entry.
Fixes #2717
🤖 Generated with Claude Code