Skip to content

Do not simplify a substitution's quotient that still varies with x, which no rewriting can take out - #2035

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
do-not-simplify-a-quotient-that-still-varies-with-x-aj
Oct 22, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
do-not-simplify-a-quotient-that-still-varies-with-x-aj

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Part of #233.

The change. The substitution search simplified every candidate's quotient with symbols in it before refusing the ones that kept an x. Some of those simplifications ran past any budget: tan(c + d x)^(11/2)/(a + b tan(c + d x))^3 spent 31 s on one candidate under u = t^(3/2). Where the quotient, with u and x read as independent, takes two values at two points, no rewriting that keeps its value can take the x out, so the simplification is skipped. The same check now runs:

  • in the step that writes the integrand as a polynomial in the candidate;
  • in the pass in the complement;
  • in the scaling of the variable, which reads at two points first whether the integrand is homogeneous.

A quotient that does not vary is simplified as before, and so is one whose candidate has a symbolic factor and may leave a power of itself.

Found by the first chain. It lost 1.2.3.2:854, 1/((d + e x) (a + b (d + e x)^2 + c (d + e x)^4)^3). Under u = t^2, the kept spelling left (d + t - d) 2 t below the bar, which is the candidate. Read with the d in it, the power of the candidate was not recognised. The kept quotient's sums in x alone now have their like terms collected, and a constant provided is read past. The row comes back in 1.0 s, against 1.1 s on master.

Chain against master f7f2a7a, after the fix:

  • The pocket of 571 rows went from 517 to 524 solved, with 0 wrong.
  • Families 3 and 6's samples went from 222 to 223 and from 471 to 472; the others are unchanged.
  • Of the 16 rows that moved, run alone, master solved 5 and this branch solves 11, all of master's five among them.
  • Two rows got much faster: 1.1.2.4:1197 from 19.6 s to 4.7 s, and 3.3:246 from 15.8 s to 0.2 s.

One trade, kept on purpose. Two rows that master answers come back in longer spellings, with more allocation:

Integrand master this branch
tanh(x)/sqrt(a + b cosh(x)^n) 589 characters 777 characters, +0.75 GB
coth(c + d x)^3/(a + b sech(c + d x))^(3/2) 8,290 characters 9,095 characters, +0.44 GB

Both are right, and v2.5.0 answers neither. Each comes from a candidate in the exponential rewrite whose leftover x is a rational function equal to a power of the candidate, in a spelling none of the cheap readings recognise. I tried and measured three narrower fences, and none separated these two rows from the gains:

  • requiring the candidate to have a symbolic factor;
  • requiring the candidate to be algebraic;
  • cancelling the x-part over one bar.

Five of the six gains depend on the skip.

Found by the full corpus on the composite of the open PRs. Eight rows that master solves were declined on this branch alone: 1.1.3.2:3483/3509, 1.2.3.2:836/861 and 2.3:213/421/422/805. Every other open PR's build solved them. None was in this branch's pocket or samples. There were two causes, each a way the kept spelling differed from the simplified one:

  • A condition over the whole quotient. The shifted linear writes c + d^0 (t - c), which inner-simplifies to 1 provided not d = 0. Under u = t^3, 1/((c + d x) (a + b (c + d x)^3)) left 1/(3 u (a + b u)) provided not d = 0, and its integral in u was declined. The simplification takes such a condition off; the kept spelling now does too.
  • x/x, which the inner simplification leaves standing. Beside u = x^x, e^(x^x) x^(2 x) (1 + ln(x)) kept (1 + ln(x))/(x/x + ln(x)), and the u^2 in it was not seen. Where an x is still left and the quotient by a power of the candidate is read at two points as one value, the kept spelling is now simplified after all and read again. That step is skipped beside a special function of x, whose value in decimals is a series: read for every kept candidate, x^5 erf(b x)^2 took 4.85 GB where master takes 1.42.

All eight come back, the earlier gains stay, and the erf rows allocate as before the fix (1.636 GB).

Chain against master 2a98be4, after both fixes:

  • The pocket of 579 rows (the 571 above plus the eight) went from 554 to 556 solved, with 0 wrong. Twenty-one timeouts on master's side were load; the moves run alone settle them.
  • Every family's sample is unchanged.
  • Of the 4 rows that moved, run alone, master solved 2 and this branch solves both, plus 3.3:245 (7.1 s, where master takes 23.1 s).
  • 6,092 rows were compared for allocation, and none grew past 1.3x and 300 MB.

The full unit suite passed locally before the fallback's fence (16,462 passed, 0 failed); this class passes on the final version, and the BREAKING-CHANGES lengths were re-measured on it. Rebased onto 78cd31b.

The full unit suite passes locally: 16287 passed, 0 failed. The branch is rebased onto 2a98be4, below master's new special-function refusal, and the gains still answer there.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 21, 2026
@Rafael-SOWNet
Rafael-SOWNet marked this pull request as draft October 21, 2026 23:15
…hich no rewriting can take out

The substitution search simplified every candidate's quotient with symbols in
it before refusing the ones that kept an x, and some of those simplifications
ran past any budget: tan(c + d x)^(11/2)/(a + b tan(c + d x))^3 spent 31 s on
one candidate under u = t^(3/2). Where the quotient in u and x, the two read
as independent, takes two values at two points, a rewriting that keeps its
value cannot take the x out; the simplification is not tried there, nor in
the step that writes the integrand as a polynomial in the candidate, nor in
the pass in the complement, and the scaling of the variable reads at two
points first whether the integrand is homogeneous. A quotient that does not
vary is simplified as before, and so is one whose candidate has a symbolic
factor and may leave a power of itself.

Kept, the quotient's sums in x alone have their like terms collected, and a
constant condition is read past: under u = t^2, what Rubi's
1/((d + e x) (a + b (d + e x)^2 + c (d + e x)^4)^3) leaves in t = d + e x is
(d + t - d) 2 t (a + b u + c u^2)^3 below the bar, whose t^2 is the
candidate, and read with the d in it, it was refused and 1.2.3.2:854 was
lost in the first chain.

Kept, the quotient also has a condition over the whole of it taken off, as the
simplification takes its own, and where an x is still left that may be a power
of the candidate, it is simplified after all and read again. Without either,
the first composite of the open branches lost eight rows master solves:
the shifted linear's d^0 is 1 provided not d = 0 inner-simplified, and
under u = t^3 Rubi's 1/((c + d x) (a + b (c + d x)^3)) left
1/(3 u (a + b u)) provided not d = 0, whose integral in u was declined; and
beside u = x^x, e^(x^x) x^(2 x) (1 + ln(x)) kept an x/x the inner
simplification leaves standing, and the u^2 in it was not seen. That second
step is taken only where the quotient by the power is read at two points and
is one value, and not beside a special function of x: read for every kept
candidate beside erf(b x), Rubi's x^5 erf(b x)^2 took 4.85 GB where it takes
1.63.

Chain against master f7f2a7a: pocket of 571 rows, 517 -> 524 solved,
0 wrong; families 3 and 6's samples 222 -> 223 and 471 -> 472, the others
unchanged; of the 16 rows that moved, alone, master solved 5 and this
solves 11, every one of master's among them, and 1.1.2.4:1197 and 3.3:246
in 4.7 s and 0.2 s where master took 19.6 s and 15.8 s. 6,048 rows
compared for allocation: two grew past 1.3x, tanh(x)/sqrt(a + b cosh(x)^n)
and coth(c + d x)^3/(a + b sech(c + d x))^(3/2), +0.75 and +0.44 GB, each
answered in another spelling (777 characters where master gives 589, and
9,095 where it gives 8,290); 2.5.0 answers neither.

Part of #233.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet
Rafael-SOWNet force-pushed the do-not-simplify-a-quotient-that-still-varies-with-x-aj branch from c009073 to a803baf Compare October 21, 2026 23:36
@Rafael-SOWNet
Rafael-SOWNet marked this pull request as ready for review October 22, 2026 00:39
@Rafael-SOWNet
Rafael-SOWNet merged commit 86fb398 into master Oct 22, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant