Skip to content

A linear over a quadratic beside the root of another, in closed form - #1583

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-linear-over-a-quadratic-beside-a-root
Sep 29, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-linear-over-a-quadratic-beside-a-root

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718: (g + h x)/(A sqrt(B)) with two different quadratics, in closed form with symbolic coefficients, which is Rubi's 1.2.1.6 and what its 4.3.9 and 4.4.9 become under the tangent.

1/sqrt(a + b tan(x) + c tan(x)^2) is 1/((1 + t^2) sqrt(a + b t + c t^2)) under the tangent, and that was where it stopped. The rational function beside a root was taken apart over linears only. Euler's substitution leaves a quartic in a field the rational integrator does not stay in. The rotation of the tangent (#1475) needs its rotation m to be a number, and with a, b, c symbols m is a nested surd.

The closed form. For a linear L = lambda + mu x, u = L/sqrt(B) has du = N dx/(2 B^(3/2)) with N = (2 mu B0 - lambda B1) + (mu B1 - 2 lambda B2) x, and alpha + beta u^2 = (alpha B + beta L^2)/B. So wherever alpha B + beta L^2 = rho A, N dx/(A sqrt(B)) is 2 rho du/(alpha + beta u^2). The three equations for alpha, beta, rho have a solution where their determinant vanishes. That is a quadratic in lambda : mu, E lambda^2 - 2 P lambda mu + F mu^2 = 0, with P = A2 B0 - A0 B2, E = A2 B1 - A1 B2 and F = A1 B0 - A0 B1. Its two roots give two numerators, independent unless q = sqrt(P^2 - E F) is zero or B is a square, and g + h x is a sum of them. The answer is two arctangents of a linear over sqrt(B), whose coefficients hold q, Rubi's q for this shape. Each piece is written 2 rho arctan(k u)/(alpha k) with k = sqrt(beta/alpha), whose derivative is right on either branch of the root, since alpha k^2 = beta exactly. Where beta/alpha is a negative number, it is written as the hyperbolic arctangent it is.

Taken apart into it. SolveARationalFunctionBesideTheRootOfAQuadratic split over distinct linears only. It now also splits over a quadratic below the bar, a power of a linear, and a power of the radicand, and closes each piece without asking the chain:

  • a linear over a quadratic, by the rule above;
  • a polynomial over a power of a linear, by the reciprocal of the linear, the way the rule for a constant over its first power already works: a polynomial over the root of the reversed quadratic, which the reduction for those closes;
  • a linear over a power of the radicand, as one half-odd power, which the same reduction reads.

The polynomial part still goes to the chain as before, after the other pieces have closed. So a piece that does not close declines the whole before any search is asked for.

Powers of linears are taken only beside a quadratic. Over squared linears alone, the reciprocal writes a sign of each linear: sgn(sqrt(1 + x) - 1), once sqrt(x + sqrt(1 + x))/x^2 is taken back from u = sqrt(1 + x). That sign's derivative is not read where the argument is not shown real, and Euler's substitution, after this rule, answers those without one (EulerSubstitutionTest.ReachedOneLevelDown pins it).

One existing test changes. MixedTrigonometricArgumentsTest.ASymbolicQuadraticInTheTangentIsDeclinedAndNotSearched pinned a quick decline for 1/sqrt(a + b tan(x) + c tan(x)^2), since the rotation of #1475 takes only a numeric rotation. The integrand is answered now, and the test says so as ...IsAnsweredAndNotSearched, still bounded by IntegrationDecline.Guard.

Input Was (2.5.0) Now
1/sqrt(a + b*tan(x) + c*tan(x)^2) integral(...) two arctangents of a linear in tan(x) over the root
(g + h*x)/((d + k*x + f*x^2)*sqrt(a + b*x + c*x^2)) integral(...) two arctangents of a linear over the root
cot(x)^3/(a + b*tan(x) + c*tan(x)^2)^(3/2) integral(...) an antiderivative
(2 + x)/((2 + 4*x - 3*x^2)*(1 + 3*x + 2*x^2)^(3/2)) integral(...); master runs past 20 s an antiderivative, in 110 ms
1/((x^2 + 1)*sqrt(x^2 + x + 1)) integral(...) a logarithm and an arctangent

QuadraticBesideARootIntegralTest differentiates thirteen such integrands back with the symbols pinned; master answers none of the thirteen.

Measured with work/intbench against master at a8a2b7e7, the commit this is cut from, 3 s a problem, on a build with the other five branches of this batch merged beside it. Every moved problem was then re-run on this branch alone:

  • Rubi's 1.2.1.6, 4.3.9 and 4.4.9 in full (217 problems): 66 → 201 solved, 0 wrong, none lost. This branch alone makes all 135 gains: 85 in 1.2.1.6, 30 in 4.3.9 and 20 in 4.4.9. Two declines got slower (unsolved → timeout). The files take 193 s instead of 217 s.
  • The families sample (families 1 to 7, five a file, 912 problems) and family 0 (1814): the merged build moved 41 problems, and re-run on this branch alone, 12 are its gains: sqrt(2 + 2 tan(x) + tan(x)^2) (Charlwood's 29), four of 1.2.1.6, four of 4.3.9 and three of 4.4.9. None of the moves is a loss of this branch's.

The unit tests pass on the merged build (net10.0, 13,514), every target builds, and the allocation gate passes.

🤖 Generated with Claude Code

(g + h x)/(A sqrt(B)) with two different quadratics was declined wherever a
coefficient was a symbol: the rational function beside a root was taken
apart over linears only, and Euler's substitution leaves a quartic in a
field the rational integrator does not stay in. For L = lambda + mu x,
u = L/sqrt(B) turns N/(A sqrt(B)) into 2 rho/(alpha + beta u^2) where
alpha B + beta L^2 = rho A, and that holds for the two roots of
E lambda^2 - 2 P lambda mu + F mu^2 = 0, P = A2 B0 - A0 B2,
E = A2 B1 - A1 B2, F = A1 B0 - A0 B1. Their two numerators span every
linear, so the answer is two arctangents of a linear over the root with
sqrt(P^2 - E F) in their coefficients, Rubi's q for 1.2.1.6, and a
hyperbolic arctangent where the ratio under a piece's root is a negative
number. The rational function beside the root is taken apart over a
quadratic, a power of a linear and a power of the radicand as well, and
each piece is closed: over a power of a linear by its reciprocal, over a
power of the radicand as one half-odd power. Powers of linears only beside a
quadratic: over squared linears alone the reciprocal writes a sign of each,
sgn(sqrt(1 + x) - 1) under u = sqrt(1 + x), whose derivative is not read,
and Euler's substitution answers those without one.

Measured with work/intbench against a8a2b7e, 3 s a problem: Rubi's
1.2.1.6, 4.3.9 and 4.4.9 in full, 66 -> 201 of 217 solved, none lost and
none wrong, every gain made by this alone; and 12 more gained over the
families sample (912 problems) and family 0 (1814), none lost.

Part of #718.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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