Skip to content

A repeated symbolic quadratic beside the linears is decomposed by the digits of the numerator in powers of the quadratic - #1392

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
repeated-symbolic-quadratic
Sep 17, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
repeated-symbolic-quadratic

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

The partial fractions of #1389 take a symbolic quadratic beside the linears to the first power; here the quadratic may be repeated. The numerators over Q, Q^2, …, Q^j are the digits of N/others written in powers of the monic quadratic, modulo Q^j: the other factors are inverted in that ring by Newton's iteration v ← v (2 − o v) from the inverse modulo Q itself (each round doubles the digits that are right), the product with the numerator is divided by the quadratic digit by digit, and the ith digit stands over leading^i Q^(j−i). Exact, symbolic, and no expansion of anything but the quadratic's own reductions.

Why. 1/((a + b x)^2 (c + d x)^(3/2)) is 1/(u^2 (K + u^2)^2) under u = sqrt(c + d x) with K = (a d − b c)/b, and went to the Hermite reduction: a hundred kilobytes in thirty seconds, unevaluable at a hundred digits, a corpus timeout. It is eight kilobytes in half a second; 1/((a + b x)^3 (c + d x)^(5/2)) three seconds to under one. The reader admits a repeated quadratic only where a symbol is present — over the rationals the system would hand it a cubic over the square, which nothing reads, and it declines as before.

Two readers on the way: a polynomial shifted to a root has a symbol over itself in a coefficient (2 (−b) c / b · t^2), which the polynomial reader's own expansion turns into a b^0 guarded by a condition and then does not read — the coefficients are gathered one term at a time; and Expand leaves (t^2)^2 of (K + t^2)^2, which is t^4 exactly and is written so before reading.

Carries #1389's commit (base master); rebased once it merges. Independent of #1391 (both build on #1389; no shared lines).

Measured. Family 1 (6 per file = 228, same harness): 136 → 137 on top of #1389 — (A + B x)/(x^3 (a + b x)^(5/2)) and 1/((a + b x)^3 (c + d x)^(5/2)) answered, and (A + B x + C x^2)/((e + f x) sqrt(a + b x) sqrt(a c − b c x)) back over the five-second budget (it is a 7–19 s answer on the neighbouring builds and a timeout on master, a borderline case rather than a loss of the rule). Independent suites 1707 → 1707, 0 wrong, 0 timeouts. Four suites green; the test differentiates five shapes back at pinned symbols and bounds each answer.

Part of #718.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 3 commits September 16, 2026 17:57
…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
… digits of the numerator in powers of the quadratic

The numerators over Q, Q^2, ..., Q^j are the digits of N/others written
in powers of the monic quadratic, modulo Q^j: the other factors are
inverted in that ring by Newton's iteration v <- v (2 - o v) from the
inverse modulo Q itself, which doubles the digits that are right each
round, the product with the numerator is divided by the quadratic digit
by digit, and the ith digit stands over leading^i Q^(j-i). The reader
admits a repeated quadratic where a symbol is present, this being its
rule to land on; over the rationals the system would hand it a cubic
over the square, which nothing reads, and it declines as before.

1/((a + b x)^2 (c + d x)^(3/2)) is 1/(u^2 (K + u^2)^2) under
u = sqrt(c + d x) with K = (a d - b c)/b, and went to the Hermite
reduction: a hundred kilobytes in thirty seconds, unevaluable at a
hundred digits. It is eight kilobytes in half a second, and
1/((a + b x)^3 (c + d x)^(5/2)) three seconds to under one.

Two readers on the way. A polynomial shifted to a root has a symbol
over itself in a coefficient, 2 (-b) c / b t^2, which the polynomial
reader's own expansion turns into a b^0 guarded by a condition and
then does not read; the coefficients are gathered one term at a time.
And Expand leaves (t^2)^2 of (K + t^2)^2, which is t^4 exactly and is
written so before reading.

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 8987d15 into master Sep 17, 2026
31 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the repeated-symbolic-quadratic branch September 17, 2026 13:34
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