Skip to content

A polynomial over a power of a linear beside the root of a quadratic is integrated by undetermined coefficients - #1701

Merged
Rafael-SOWNet merged 6 commits into
masterfrom
a-polynomial-beside-the-root-of-a-quadratic
Oct 3, 2026
Merged

Rafael-SOWNet merged 6 commits into
masterfrom
a-polynomial-beside-the-root-of-a-quadratic

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718.

P(x) Q^(m/2)/(g + h x)^k, a polynomial over a power of a linear beside a half-odd power of a quadratic, was declined or ran past the corpus's budget wherever the linear was below the bar to a power past the first, and with a symbol in the linear or in Q even to the first. These are Rubi's 1.2.1.9, and with P constant or linear, much of 1.2.1.2 to 1.2.1.4:

integrand master this
1/((g + h x) sqrt(a + c x^2)) declined 0.3 s
(d + k x + f x^2) sqrt(a + c x^2)/(g + h x)^4 declined after 4.9 s 0.5 s
(a + b x + c x^2)^(3/2) (d + k x + f x^2)/(g + h x)^2 past 20 s 0.6 s
(2 + x + 3 x^2 - x^3 + 5 x^4) sqrt(3 - x + 2 x^2)/(5 + 2 x)^5 declined 0.3 s
(a d m + (c d^2 + a m^2) x + c d m x^2)^(5/2)/(d + m x)^4 past 20 s 0.5 s
sqrt(x^2 + 1)/x^2 -1/(x/sqrt(1 + x^2)) and the logarithm of a quotient of 1 ± x/sqrt(1 + x^2) -sqrt(x^2 + 1)/x + ln(2 sqrt(x^2 + 1) + 2 x)

What changes. The rule for the roots of two linears (#1697) uses nothing of the two but S' = Q'/(2 S): a triangular system for the polynomial part, and a recurrence down the powers of the linear to the integral of 1/((g + h x) S). That core is shared now, as IntegrateOverARootOfAQuadratic, and the root of one quadratic is read into it too. The answers of the rule for two linear roots are the same as before, on every shape tried.

The two integrals left are, with Q = q0 + q1 x + q2 x^2:

  • int 1/S: ln(2 sqrt(q2) S + 2 q2 x + q1)/sqrt(q2), or -arcsin((2 q2 x + q1)/sqrt(q1^2 - 4 q0 q2))/sqrt(-q2) where q2 < 0, as the root of a quadratic alone is answered;
  • int 1/((g + h x) S): with H = q0 h^2 - q1 g h + q2 g^2, which is h^2 Q at the linear's root, and Z = 2 q0 h - q1 g + (q1 h - 2 q2 g) x, -artanh(Z/(2 sqrt(H) S))/sqrt(H) where H > 0, and arctan(Z/(2 sqrt(-H) S))/sqrt(-H) where H < 0. Since Z^2 - 4 H Q = (q1^2 - 4 q0 q2)(g + h x)^2, the artanh's argument is less than 1 in size where Q has no real root and more where it has two; it is written as the logarithm that is real on each side.

Where a quantity is a symbol's, every form is given, each where it holds, in one piecewise. Where the linear shares a root with Q, H is zero, and every power of the linear is algebraic: int 1/((x - xi) S) = -2 S/(Q'(xi) (x - xi)), and the recurrence runs up from it.

The rule answers only with the linear below the bar, and a first power of it only with a symbol in it. A polynomial beside the root alone, and a constant over a linear with numbers, are what the rules further down answer, and they keep their answers.

Tests: PowerOfALinearBesideTheRootOfAQuadraticTest: seven symbolic rows each pinned on both sides of the two signs, so that every arm is differentiated back; five beside a shared root; four of Rubi's with numbers; and four checking that the antiderivative is real wherever the integrand is, one on each side of the discriminant, which a differentiation back cannot see.

Measured first on the 858 problems of Rubi's 1.2.1.2 to 1.2.1.4 and 1.2.1.9 that the rule can be asked about, both builds side by side, against master 0dd86927:

master this
solved 584 852
wrong 0 0

268 more are answered, 126 of them in 1.2.1.3, 74 in 1.2.1.2, 52 in 1.2.1.9 and 16 in 1.2.1.4, and none that master answers is lost. On the 584 that both answer, the total time is 137 s here against 491 s on master. Of the six left, four have a perfect square under the root, which this rule leaves to the rules for a square, and two are the ninth and tenth power of a linear that divides the quadratic, which run to the budget on both builds.

Measured then on the Rubi corpus against master 0dd86927, which is merged in:

master this
family 0, independent suites (1814) 1758 1758
family 1, 40 a file (1381) 1180 1196
families 2 to 8, sampled (2410) 2167 2167

No answer is wrong on either build.

273 problems moved between the two builds, the pocket's among them, so I re-ran each alone on both. This branch answers all 273, and master none of them.

The suite passes on the commit measured, 1a7f8d68, 14,457 tests, and so does the allocation gate. Master 3fba4e5d is merged in since, without conflicts, and the calculus tests pass on the merge, 3,794 of them.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 6 commits October 2, 2026 22:28
…is integrated by undetermined coefficients

Rubi's 1.2.1.9, P(x) Q^(m/2)/(g + h x)^k, was declined or ran past the
corpus's budget wherever the linear was below the bar to a power past
the first, and with symbols in it even to the first: the rules for one
root of a quadratic take apart a product of distinct linears beside it,
and their closed rule for a constant over a linear declined
1/((g + h x) sqrt(a + c x^2)).

The rule for the roots of two linears uses nothing of the two but
S' = Q'/(2 S): a triangular system for the polynomial part, and a
recurrence down the powers of the linear to the integral of
1/((g + h x) S). That core is shared now, and the root of one quadratic
is read into it as well. The two integrals left are a logarithm or an
arcsine of the quadratic's derivative, by the sign of its leading
coefficient, as the root of a quadratic alone is answered; and an
artanh or an arctan of (2 q0 h - q1 g + (q1 h - 2 q2 g) x)/(2 sqrt(+-H) S),
by the sign of H = h^2 Q(-g/h). Where the sign is a symbol's, both
are given, each where it holds.

It answers only with the linear below the bar, and a first power of it
only with a symbol in it: what the rules further down answer keeps
their answers. The answers of the rule for two linear roots are the
same as before.

Part of #718.

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

Where Q vanishes at the linear's root, Q = beta s + gamma s^2 with
s = x - xi, and the derivative of sqrt(Q) s^(-j) is
((1 - 2j) beta s^(-j) + (2 - 2j) gamma s^(1-j))/(2 sqrt(Q)): from
int 1/(s sqrt(Q)) = -2 sqrt(Q)/(beta s) up, each power is algebraic,
and there is no third integral. Rubi writes these as
(a d e + (c d^2 + a e^2) x + c d e x^2)^p over powers of d + e x, and
sqrt(d^2 - e^2 x^2) over powers of d + e x, which ran past the budget.

And a number times even powers of symbols has the number's sign
wherever the symbols are real: the root of d^2 - e^2 x^2 has the
arcsine alone, since -e^2 is negative.

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

int 1/((g + h x) sqrt(Q)) is -artanh(z)/sqrt(H) where H, h^2 Q at the
linear's root, is positive, with z = Z/(2 sqrt(H) sqrt(Q)). Since
Z^2 - 4 H Q = (q1^2 - 4 q0 q2) (g + h x)^2, z is less than 1 in size
wherever Q has no real root, and the logarithm of (1 + z)/(1 - z) is
real, and more than 1 wherever it has two, where the logarithm of
(z + 1)/(z - 1) is: the antiderivative of sqrt(4 - x^2)/x^3 is real
on the whole of (-2, 2). With symbols, both are given, each where it
holds, in one piecewise with the arctangent.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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