Skip to content

A symbolic quadratic with a square discriminant, split into its linears where the numerator shares one - #1835

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
symbolic-quadratics-split-over-the-symbols
Oct 10, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
symbolic-quadratics-split-over-the-symbols

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718.

(d + e x)^8/(a d e + (c d^2 + a e^2) x + c d e x^2)^2 ran past a minute, with eleven more of Rubi's 1.2.1.2: a power of a linear over a power of a quadratic that is that linear times another. The quadratic's discriminant is the square of a polynomial in the symbols, (c d^2 - a e^2)^2, so it is (d + e x)(a e + c d x). Over the quadratic as written, the division of the improper fraction and a substitution search ran out the time. Over its linears the shared power cancels and the rest is answered in a second.

SolveByPartialFractions now writes such a quadratic as (2A x + B - S)(2A x + B + S)/(4A) before the division, with S from MultivariatePolynomial.TrySquareRoot (#1831). It does this only where a polynomial numerator vanishes at the root of one of the two linears, which is what the split is for. A quadratic made monic first, with its coefficients over the leading one's symbols, is written over one bar and its numerator split. The numerator's sums are spelled as the split spells its linears, so the shared power is gathered and cancelled before anything else reads the quotient. #1831's helper for a quartic in x^2 now takes either step, and its call moves above a comment it had been put in the middle of.

integrand 2.5.0 master 24351278 this
(d + e x)^8/(a d e + (c d^2 + a e^2) x + c d e x^2)^2 past a minute past a minute 5,126 characters, 2.1 s
(a + b x)^6/(a c + (b c + a d) x + b d x^2)^2 past a minute past a minute 3,592 characters, 0.4 s
(d + e x)^10/(a d e + (c d^2 + a e^2) x + c d e x^2)^4 past a minute past a minute 26,054 characters, 2.2 s
csc(x)^3/(a + b tan(x)^2)^2 declined past a minute 7,992 characters, 0.2 s

x stands for e + f x in the last row, which is what was probed.

The first version split every such quadratic. On 7.4.1's (a + b arccoth(c x)) (d + e ln(1 - c^2 x^2)), which master answers in 13 seconds, parts left 1 - c^2 x^2 with nothing to cancel against. Split, it ran past two minutes. Now the split happens only where the numerator is a polynomial sharing a linear, and that problem is answered in 12.8 seconds as before.

Tests: ASymbolicQuadraticSplitIntegralTest, the first row and (a + b x)^6/(a c + (b c + a d) x + b d x^2)^3, each differentiated back and compared at six points. The pins put c d above one. Below about 0.6, the conditions these answers carry, not (c d)^68 = 0 and the like, evaluate false: (0.54)^60 = 0 is True. Master's answers have the same conditions. That is #1376's defect, and the case is recorded there.

Measured on 14,109 corpus problems, every one whose integrand is a rational function and every one with a secant or a cosecant in it, at the corpus's 5-second budget, against master 24351278:

master this
solved 13912 13926
unevaluated 98 98
wrong 0 0
past the budget 86 72

Fourteen problems are answered here and not on master, twelve of 1.2.1.2 and two of 4.3.7, and none the other way. On the 13,912 both answer the time is 2,126 seconds on master and 2,102 here.

master this
family 0, independent suites (1814) 1782 1782
family 1, 40 a file (1381) 1341 1341
families 2 to 8, sampled (2410) 2331 2331

The harness counts no answer wrong in either. The fourteen problems the builds disagreed on, run again one build at a time: master answers none within the budget, this all fourteen.

The suite passes: 15,190 passed, 13 skipped, none failed. The allocation gate passes: every gated benchmark allocates what the baseline says. The library builds for every target. The entry in BREAKING-CHANGES.md is measured on a build of 2.5.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 3 commits October 9, 2026 21:18
…rs before the division

Part of #718.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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 10, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit 314fa88 into master Oct 10, 2026
34 checks passed
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