Skip to content

Beside the roots of two linears, a polynomial over a power of a third is integrated by undetermined coefficients - #1697

Merged
Rafael-SOWNet merged 6 commits into
masterfrom
a-polynomial-beside-the-roots-of-two-linears
Oct 2, 2026
Merged

Rafael-SOWNet merged 6 commits into
masterfrom
a-polynomial-beside-the-roots-of-two-linears

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Part of #718.

Rubi's 1.1.1.6 is P(x) (a + b x)^m (c + d x)^n (e + f x)^p. With symbols in the linears, a polynomial beside sqrt(c + d x) sqrt(e + f x) went through the quotient of the two roots, t = sqrt(c + d x)/sqrt(e + f x). Its rational function in t is over a power of d - f t^2 that grows with the degree of P. (A + B x + C x^2) sqrt(c + d x) sqrt(e + f x) took more than 4 GB of memory that way, and nothing over a third linear below the bar was answered:

integrand master this
(A + B x + C x^2) sqrt(c + d x) sqrt(e + f x) past 4 GB of memory 0.46 s
(e + f x)^3 (A + B x + C x^2) sqrt(a + b x) sqrt(a c - b c x) past 4 GB of memory 0.56 s
(A + B x + C x^2) sqrt(c + d x) sqrt(e + f x)/(a + b x)^3 past the budget 0.75 s
(A + B x + C x^2) sqrt(c + d x)/((a + b x) sqrt(e + f x)) still running a minute after it was cancelled 0.47 s
(A + B x + C x^2)/((e + f x)^2 sqrt(a + b x) sqrt(a c - b c x)) past the budget 0.55 s

Of the 19 problems that master leaves unsolved in a sample of 40 from 1.1.1.6, this answers all 19, each in under a second on a loaded machine, and each differentiates back. On master, 8 ran past 4 GB, 9 ran past a 10 s budget, and 2 had not stopped a minute after they were cancelled.

What changes. Write S = sqrt(c + d x) sqrt(e + f x) and Q = (c + d x)(e + f x). The integrand is T/((g + h x)^k S) with T a polynomial. Because sqrt(z)^2 = z for every complex z, S' = Q'/(2 S). Then:

  • The terms of T from (g + h x)^k up are a polynomial R. int R/S is U S + lambda int 1/S, where R = U' Q + U Q'/2 + lambda, a triangular system for the coefficients of U.
  • Each term over a power of g + h x comes down to int 1/((g + h x) S), by the recurrence the derivative of S (g + h x)^(1-j) gives.
  • The two integrals left are a logarithm and an arctangent of sqrt(c + d x)/sqrt(e + f x). Each differentiates back wherever sqrt(z)^2 = z, which is everywhere. Each is real for one sign of the quantity under its roots: for a number, the form for its sign is written; for a quantity with symbols, both are, each provided where it holds, as 1/(a - x^2) is answered.

The recurrence runs with a symbol for the third linear's root, so that everything it computes is polynomial in it, and -g/h goes back once at the end, written homogeneous in g and h.

The rule takes only linears with a symbol in them. It runs after the combining of roots and before the quotient substitution, and with numbers in both linears those two answer as before.

Tests: TwoLinearRadicalsIntegralTest.APolynomialBesideTheRootsOfTwoLinears (eight rows) and OverAPowerOfAThirdLinear (four), each differentiated back with the symbols pinned. The helper there zeroed C to drop the integration constant, which here is a coefficient: the constant is C_1 where the integrand has a C, and the helper now leaves the answer alone then.

Measured on the Rubi corpus against master eaf3cde5, the branch's base, with both builds side by side:

master this
family 0, independent suites (1814) 1758 1758
family 1, 40 a file (1381) 1117 1139
families 2 to 8, sampled (2410) 2145 2144

No answer is wrong on either build.

And on the whole of Rubi's 1.1.1.3 to 1.1.1.7, 2690 problems, this branch answers 2529 against master's 2388. Ten that master answered ran out of time here, but re-run side by side they come out the same on both builds: three answered and seven out of time on each. They were near the budget either way.

Thirty problems moved between the two runs, so I re-ran each alone on both builds. This branch answers 27 of them and master 4, neither wrongly, and none that master answers is lost. The one in family 6 that moved the other way, 6.7.1:180, is among them: alone, this branch answers it and master runs out of time, so it is near the budget on both.

The suite passes, 14,364 tests on a fresh build, and so does the allocation gate. Both were run before the two commits below.

Master 58581667 is merged in since; its one conflict was rows both sides added to TwoLinearRadicalsIntegralTest. On the merge, #1683's 1/(e^atanh(a x) (c - c/(a x))^(3/2)) ran out of time. Writing each linear once, it came to two linear radicals over a third linear. The logarithm this branch wrote for a symbolic quantity was complex, by a constant, on the interval that arm checks, so the arm failed. With both forms given by sign, the integral is answered in 0.8 s, against 2 s on master. The calculus tests pass on that merge with a34dbc3b, 3,711 of them. After the merge with 58581667, the four test classes nearest the change pass, 101 tests. The 151 problems the pocket gained, and the 30 moves, were run again on the final commit: all still answered, none wrong.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 5 commits October 2, 2026 13:33
… is integrated by undetermined coefficients

Rubi's 1.1.1.6, a polynomial beside sqrt(c + d x) sqrt(e + f x) with
symbols in the linears, went through the quotient of the two roots.
Its rational function in t is over a power of d - f t^2 that grows
with the degree of the polynomial, and (A + B x + C x^2) sqrt(c + d x)
sqrt(e + f x) took more than 4 GB; with one more linear below the bar
it ran past every budget.

Now T/((g + h x)^k S), S the product of the two roots and T a
polynomial, is U S plus multiples of two integrals. The polynomial part
solves R = U' Q + U Q'/2 + lambda, which is triangular, and each power
of the third linear below the bar comes down to the integral of
1/((g + h x) S) by the recurrence its derivative gives. The two
integrals left are an artanh and an arctan of sqrt(c + d x)/sqrt(e + f x),
each exact wherever sqrt(z)^2 = z, which is everywhere. Each of the
nineteen 1.1.1.6 problems tried is answered, in under a second, and differentiates back.

Part of #718.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…inears

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…with a symbol in them

With numbers in both linears the combining of roots and the quotient
substitution answer, in their own forms, and the rule is for the symbols
that those declined or took gigabytes over: below the top, where the
combining does not run, it would otherwise answer what they did, in
another form.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…-the-roots-of-two-linears

# Conflicts:
#	Sources/Tests/UnitTests/Calculus/TwoLinearRadicalsIntegralTest.cs
The integral of 1/S is a logarithm for one sign of d/b and an arctangent
for the other, and the third kind's is the same in rho. Where the
quantity has symbols in it, both are given, each provided where it holds,
as 1/(a - x^2) is answered. One form alone is complex, by a constant, on
the side where the other is real, and an answer that writes each linear
once checks its arms there.

Part of #718.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 2, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit f2f1ce1 into master Oct 2, 2026
34 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the a-polynomial-beside-the-roots-of-two-linears branch October 29, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant