A symbolic parameter no longer stops a rational integrand being integrated, and 16 more Rubi integrals come out - #1249
Merged
Merged
Conversation
…rated, and 16 more Rubi integrals come out
`1/(8 + x^3)` and `1/(16 - x^4)` are answered at once. `1/(a^3 + x^3)` and
`1/(a^4 - x^4)` were not. The parameter is the whole difference: the rational
rules read a denominator as a polynomial over the rationals, and `a^3` is not a
coefficient they can work with, so the factoring that answers `x^3 + 8` has
nothing to hold on to for `x^3 + a^3`.
Two things were in the way and both are fixed here.
A constant factor inside the denominator stayed there. The two branches that
take a factor out of a quotient each want the whole of one side free of the
variable, so `a * (1/(1 + x^3))` was taken apart and `1/(a*(1 + x^3))` -- the
same number -- was not. Taking the constant out now happens first, before the
branch that turns `c/g(x)` into `c * g(x)^(-1)`, because a power is a shape the
rational rules do not read.
And the integrand is scaled by its parameter. With `x = c t` and `dx = c dt` a
homogeneous integrand becomes a constant times a function of `t` alone --
`1/(a^3 + x^3)` becomes `a^(-2)/(1 + t^3)`, whose denominator has integer
coefficients again -- and the answer is read at `t = x/c`.
Homogeneity is checked rather than assumed, and the check is what makes this
terminate. The scaled integrand has to divide into a factor free of `t` times a
function of `t`, and only the second is handed on, so the sub-problem has one
variable and cannot be scaled again. Two parameters is declined for exactly that
reason: scaling by one leaves the other.
Nothing is owed as a condition, and one thing is worth being exact about
instead: `c = 0` is not a scaling, and `a^(-2) G(x/a)` has no value there. That
is the honest report for a substitution that does not exist rather than a wrong
answer, and `1/(a^3 + x^3)` at `a = 0` is a different function which is answered
on its own if asked that way.
It runs last of the rewrites, because unlike the others it fires on an integrand
nothing is wrong with -- it clears a parameter rather than a shape -- so
everything that can answer the problem as written tries first.
Measured on Rubi's independent test suites, same corpus and flags, both arms on
this machine:
before (2dbeedf) 913/1774, 0 wrong, 13 timeouts, 722s
after 929/1774, 0 wrong, 16 timeouts, 794s
Sixteen more answers and no wrong ones, for about 10% more wall clock. Each of
the newly answered was also checked by differentiating it back with the
parameter pinned and comparing at five points.
Suites: UnitTests 8514 and 1557, FSharpWrapperUnitTests 134,
InteractiveWrapperUnitTests 18, TerminalUnitTests 41.
#718
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Member
Author
|
Merge order against the other two open ones. This does not conflict with #1245 at all. It conflicts with #1248 in two places — the end of Composed on a throwaway branch to check they do more than merge, since #1248 changes how partial fractions reads a quotient and this changes the order in which a factor comes out of one: Whichever you take second I will rebase. |
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/(8 + x^3)and1/(16 - x^4)are answered at once.1/(a^3 + x^3)and1/(a^4 - x^4)were not.The parameter is the whole difference. The rational rules read a denominator as a polynomial over
the rationals —
TryGetRationalCoefficientsis the gate — soa^3is not a coefficient they canwork with, and the factoring that answers
x^3 + 8has nothing to hold on to forx^3 + a^3.Measured rather than assumed, on
master:Two things were in the way
A constant factor inside the denominator stayed there. The two branches that take a factor out
of a quotient each want the whole of one side free of the variable, so
a * (1/(1 + x^3))was takenapart and
1/(a*(1 + x^3)), the same number, was not. Taking the constant out now happens first,before the branch that turns
c/g(x)intoc * g(x)^(-1)— a power being a shape the rationalrules do not read, that ordering is what decides these.
And the integrand is scaled by its parameter. With
x = c tanddx = c dta homogeneousintegrand becomes a constant times a function of
talone:1/(a^3 + x^3)becomesa^(-2)/(1 + t^3), whose denominator has integer coefficients again. The answer is read att = x/c.Homogeneity is checked, and the check is what makes it terminate
The scaled integrand has to divide into a factor free of
ttimes a function oft, and only thesecond is handed on — so the sub-problem has one variable and cannot be scaled again. Without that,
the rule would hand on something still carrying
cand scale it once more at every level.x/((a^2 + x^2)*(b^2 + x^2))is declined for exactly that reason: scaling by one parameter leavesthe other. It is in the tests as a decline, so the check is exercised rather than assumed.
Measured on Rubi's independent test suites
Same corpus and flags, both arms on this machine:
2dbeedf7(master)Sixteen more answers and no wrong ones, for about 10% more wall clock. Newly answered includes the
whole
1/(x^k (a^n ± x^n))family, which is where this runs long in Timofeev's set. Each was alsochecked by differentiating it back with the parameter pinned and comparing at five points.
Where the answer is not defined
c = 0is not a scaling, anda^(-2) G(x/a)has no value there. That is the honest report for asubstitution that does not exist rather than a wrong answer — and
1/(a^3 + x^3)ata = 0is adifferent function,
1/x^3, which is answered on its own if asked that way. Recorded inBREAKING-CHANGES.mdrather than left to be discovered.Ordering
It runs last of the rewrites, because unlike the others it fires on an integrand nothing is
wrong with — it clears a parameter rather than a shape.
a*sin(x),a*x^2,a/x,sin(a*x),x*e^(a*x)and1/(1 + x^3)are all in the tests to hold that: they were answered before and areanswered by the same rules now.
Suites
UnitTests8514 and 1557,FSharpWrapperUnitTests134,InteractiveWrapperUnitTests18,TerminalUnitTests41. New fileScaledVariableIntegralTest.cs, 28 cases.Part of #718.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura