Skip to content

A symbolic linear factor beside a quadratic is decomposed by its Taylor coefficients, the quadratic's numerator by the residue modulo it, and a decomposition is integrated term by term - #1389

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
linear-blocks-beside-a-quadratic
Sep 17, 2026
Merged

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

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Every rational function of the tangent with a power of a linear in it — Rubi's tan^4 (A + B tan)/(a + b tan)^4 is u^4 (A + B u)/((a + b u)^4 (1 + u^2)) under the substitution — went to the Hermite reduction, because the partial-fraction gate for symbolic linear factors asked for linears only. The reduction answered it in a^63 b^10: right, and not evaluating within the corpus's budget, so a timeout. Cut from master; touches PartialFractions, the gate and one consumer in SolveByPartialFractions, and a bound on PolynomialGcd.TryCancel.

What changes. The gate admits quadratic factors to the first power beside the linears, and the decomposition is computed where each piece lives:

  • the coefficient of 1/F^j over a linear F of multiplicity k is beta^(j-k) times the (k-j)th Taylor coefficient at the root of the numerator over the other factors — by the quotient of the two polynomials' own series at the root, one division per order. Differentiating the quotient symbolically gives the same numbers as quotients of derivatives the gcd does not cancel (b^249 at the third order);
  • the numerator over a quadratic is the residue of the numerator times the inverses of the other factors in the ring modulo the quadratic: two coefficients, each a small quotient, nothing expanded but the quadratic's own reductions;
  • PolynomialGcd.TryCancel takes an optional bound (the 256-node default is the simplifier's), and where the gcd still declines past its degree and step limits the written factors of the denominator (b^9 (a^2 + b^2)^7, as a series leaves it) are divided out of the numerator exactly for as long as that goes;
  • a decomposition is integrated one term at a time as written. Handed to the chain whole, a sum with a term past LargestTermTakenAsWritten went through the expanding gather, which combined D^(-1) (P + Q x)/(1 + x^2) into (P + Q x)/(D + D x^2) — a quadratic with symbols in every coefficient, integrated as a piecewise on the sign of its discriminant.

x^4 (A + B x)/((a + b x)^4 (1 + x^2)) is now a line of arctangents and logarithms in a quarter of a second, the tangent form with it.

Measured. Rubi family 4 (trigonometric, 6 per file = 422): 220 → 225 solved, five timeouts answered (tan^4 (A + B tan)/(a + b tan)^4, (a + b tan)^2 (A + B tan + C tan^2)/(c + d tan)^3, cos^2 (A + B sec + C sec^2)/(a + b sec), csc^5/(a + b sin^2), sin^6/(a + b sec)), one decline now a timeout (sin^2 (a + a sin)^(3/2) (c − c sin), a half-integer power the gate lets further in), 0 changed answers. The independent suites: 1707 → 1707, 0 wrong, 0 timeouts. Four suites green; the new test checks five shapes differentiate back at pinned symbols and that each answer is under a page.

The seven family-4 wrong answers this run reports are master's, fixed in #1388 (this branch is from master and independent of it).

Part of #718.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…or coefficients and the quadratic's numerator by the residue modulo it, and a decomposition is integrated term by term

Every rational function of the tangent with a power of a linear in
it -- Rubi's tan^4 (A + B tan)/(a + b tan)^4 is u^4 (A + B u)/((a + b u)^4 (1 + u^2))
under the substitution -- went to the Hermite reduction, because the
partial-fraction gate for symbolic linear factors asked for linears
only, and the reduction answered it in a^63 b^10, right and unusable:
the answer did not evaluate within the corpus's budget. The gate now
admits quadratic factors to the first power beside the linears, and
the decomposition is computed where each piece lives. The coefficient
of 1/F^j over a linear F of multiplicity k is beta^(j-k) times the
(k-j)th Taylor coefficient at the root of the numerator over the other
factors, by the quotient of the two polynomials' own series at the
root -- differentiating the quotient symbolically gives the same
numbers as quotients of derivatives the gcd does not cancel, in b^249
at the third order. The numerator over a quadratic is the residue of
the numerator times the inverses of the other factors in the ring
modulo the quadratic: two coefficients, each a small quotient, with
nothing expanded but the quadratic's own reductions.

Two things around it. The gcd that puts a coefficient in lowest terms
is bounded at 256 nodes for the simplifier's sake, and a fourth-order
block's coefficient is eleven hundred; the partial-fraction caller may
raise the bound, and where the gcd still declines past its degree and
step limits, the written factors of the denominator -- a series leaves
b^9 (a^2 + b^2)^7 -- are divided out of the numerator exactly for as
long as that goes. And a decomposition is now integrated one term at a
time as written: handed to the chain whole, a sum with a term past the
size taken as written went through the expanding gather, which
combined D^(-1) (P + Q x)/(1 + x^2) into (P + Q x)/(D + D x^2), a
quadratic with symbols in every coefficient, integrated as a piecewise
on the sign of its discriminant.

x^4 (A + B x)/((a + b x)^4 (1 + x^2)) is a line of arctangents and
logarithms in a quarter of a second, and the tangent form with it.

Part of #718.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet
Rafael-SOWNet merged commit 4f05813 into master Sep 17, 2026
31 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the linear-blocks-beside-a-quadratic branch September 17, 2026 11:40
Rafael-SOWNet added a commit that referenced this pull request Sep 17, 2026
…powers of the linear at its root (#1391)

* A symbolic linear factor beside a quadratic is decomposed by its Taylor coefficients and the quadratic's numerator by the residue modulo it, and a decomposition is integrated term by term

Every rational function of the tangent with a power of a linear in
it -- Rubi's tan^4 (A + B tan)/(a + b tan)^4 is u^4 (A + B u)/((a + b u)^4 (1 + u^2))
under the substitution -- went to the Hermite reduction, because the
partial-fraction gate for symbolic linear factors asked for linears
only, and the reduction answered it in a^63 b^10, right and unusable:
the answer did not evaluate within the corpus's budget. The gate now
admits quadratic factors to the first power beside the linears, and
the decomposition is computed where each piece lives. The coefficient
of 1/F^j over a linear F of multiplicity k is beta^(j-k) times the
(k-j)th Taylor coefficient at the root of the numerator over the other
factors, by the quotient of the two polynomials' own series at the
root -- differentiating the quotient symbolically gives the same
numbers as quotients of derivatives the gcd does not cancel, in b^249
at the third order. The numerator over a quadratic is the residue of
the numerator times the inverses of the other factors in the ring
modulo the quadratic: two coefficients, each a small quotient, with
nothing expanded but the quadratic's own reductions.

Two things around it. The gcd that puts a coefficient in lowest terms
is bounded at 256 nodes for the simplifier's sake, and a fourth-order
block's coefficient is eleven hundred; the partial-fraction caller may
raise the bound, and where the gcd still declines past its degree and
step limits, the written factors of the denominator -- a series leaves
b^9 (a^2 + b^2)^7 -- are divided out of the numerator exactly for as
long as that goes. And a decomposition is now integrated one term at a
time as written: handed to the chain whole, a sum with a term past the
size taken as written went through the expanding gather, which
combined D^(-1) (P + Q x)/(1 + x^2) into (P + Q x)/(D + D x^2), a
quadratic with symbols in every coefficient, integrated as a piecewise
on the sign of its discriminant.

x^4 (A + B x)/((a + b x)^4 (1 + x^2)) is a line of arctangents and
logarithms in a quarter of a second, and the tangent form with it.

Part of #718.

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

* A polynomial over a power of a linear beside a radical is written in powers of the linear at its root, and what the power divides goes over the radical alone

P(x)/((a + b x)^k S(x)) with S not a polynomial in x: P is
p_0 + p_1 (a + b x) + ... + (a + b x)^k Q(x), a polynomial identity whose
coefficients are the Taylor coefficients of P at -a/b over the powers
of b, so the integrand is Q/S + sum p_j/((a + b x)^(k-j) S) exactly and
everywhere, and each piece is integrated on its own.

(A + B x + C x^2 + D x^3)/((a + b x) sqrt(c + d x)) was answered through
the substitution u = sqrt(c + d x) term by term, a cubic in u^2 - c
over a symbolic quadratic in u each time, in a hundred kilobytes of
piecewise that did not evaluate within the corpus's budget: three of
six in Rubi's P(x) (a + b x)^m (c + d x)^n file and four of six in the
next were timeouts of that kind. Reduced, it is a quadratic over the
root, three powers by the substitution, and one
p_0/((a + b x) sqrt(c + d x)); under four kilobytes in half a second.

Before the sum is split, so that the whole polynomial is reduced once
rather than each of its terms, and only beside a factor that is not a
polynomial, a quotient of polynomials being the partial fractions' to
take apart. Carries #1389's commit for the Taylor coefficients at a
root, which are its.

Part of #718.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Rafael-SOWNet added a commit that referenced this pull request Sep 18, 2026
… its rational content included, and a constant factor is not a symbolic coefficient (#1408)

* A partial-fraction coefficient with symbols in it is in lowest terms, its rational content included, and a constant factor is not a symbolic coefficient

Two rows of the Rubi hyperbolic sample that were answered in under two
seconds became timeouts: csch(x)^5/(a + b cosh(x)) with #1389 and
tanh(x)^6/(a + a sech(x)) with #1392. Both are the symbolic
partial-fraction decomposition, and both are coefficients that were not
in lowest terms.

InLowestTermsOverTheSymbols put a coefficient in lowest terms by the
polynomial gcd, which normalizes its divisor to whole coprime
coefficients and so never cancels a number, and calls two sides without
a variable in common coprime before it looks: -1024/(1024 a) stayed as
it was. Newton's iteration for the inverse modulo (1 + u^2)^6 squares
its iterate every round, so the second round had 1024^2 and the third
integers of twelve hundred digits, and the minute went into their gcd.
The rational content of the denominator now goes up into the numerator
-- the denominator's coefficients whole and coprime with a positive
leading one, by the normalization the gcd already has, with the scale
it used handed back -- on every path out of the function.

The values the elimination solves for, where symbols are among them,
are put in lowest terms before the terms are built. csch^5/(a + b cosh)
under u = e^x, after the Hermite reduction, is a numerator with a page
of a and b over (u^2 - 1)(b + 2 a u + b u^2), and its values came out
at two thousand nodes each as quotients of determinants; each term
went round the chain with that in front and did not return. In lowest
terms they are 1/256 (3 a^3 - 7 a b^2)/(a^4 - 2 a^2 b^2 + b^4) and the
like, the answer is 27 kilobytes where it was 59, and the row is 1.3 s.

And the content of a written sum comes out before the symbolic split
rather than after it, and a constant factor in front of the denominator
does not make the split's gate read it as symbolic: a (1 + u^2) + 2 a u
is a (1 + u)^2, a repeated linear over the rationals, which the
refactoring and the Hermite reduction read, where the split computed
its digits with a in every coefficient for an answer twice the length.
tanh^6/(a + a sech) is 6.7 kilobytes and 2 s, from 7.8 kilobytes before
the regression.

Measured: the two rows and their rational cores under the wall-clock
guard in SymbolicFactorsPartialFractionsTest, differentiated back; the
suite green; the independent Rubi suite and the family-6 sample are in
the pull request.

Part of #718.

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

* A value of the elimination is put in lowest terms only under a bound

The family-6 sample lost two rows to the first commit:
cosh(c + d x)^6/(a + b sinh(c + d x)^2)^2 and 1/(a + b csch(c + d x)^2)^3,
6.4 s and 3.4 s on master and past the budget on the branch. Their
elimination hands back values of twelve to twenty-eight thousand nodes,
and the lowest terms of one -- an expansion and a gcd -- did not return
in three seconds, where the answer with them as they come is six.
A value past 4096 in complexity is left as the elimination gave it;
the ones that needed the lowest terms were two thousand nodes.

Part of #718.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <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