Skip to content

A perfect square written with symbols is read as one - #1477

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
perfect-square-symbolic
Sep 23, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
perfect-square-symbolic

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

(A + B x)(d + e x)/(a^2 + 2 a b x + b^2 x^2)^(5/2) was left as written, though the radicand is (a + b x)^2 and the power is |a + b x|^5. Three conditions said no, and they are three different kinds of mistake:

  1. The discriminant was not read symbolically. 4 a^2 b^2 - 4 a^2 b^2 is a zero InnerSimplified does not collect, so the guard read the square as an ordinary quadratic. (Third instance of this shape tonight, after An exponential times a trigonometric at the same frequency no longer divides by zero, and a phase is expanded #1472 and A symbolic constant factor no longer stops the rounds of parts #1473.)
  2. The leading coefficient had to be a number. b^2 is not one, but it is positive for a real parameter — IsPositiveForARealParameter is the library's own answer to that, and its condition b^2 > 0 travels with the answer as it does elsewhere. Requiring positivity is right; requiring a literal is not.
  3. My own complexity bound. The rule reads a radicand only up to a size, so that it costs nothing at every level of the descent — and a^2 + 2abx + b^2x^2 is over it. Lifted at the top, where the rule may work harder; below it, the square root only, for the reason A power of x beside a function of a symbolic power of x is integrated by substituting the power, and a square root of a perfect square is the modulus at every depth #1462 measured (a sign written for a substitution's variable is a factor the rest of the search carries: (1 + 2u + u^2)^(5/2) under u = e^(2x) cost twenty seconds).

And one defect the corpus found that no probe of mine had: with the sign written into the integrand, a rule below differentiates it, and sqrt(a^2 + 2abx + b^2x^2) sqrt(c + ex + dx^2) threw CannotEvalException: derivative(sgn(...)). The first measured run of this change reported 1 error where there had been none. The sign now goes in front of the integral, which is what every rule here that writes one does, and that row answers in half a second.

Measured (final build):

  • Family 1 (familycap.sh 1 6): 156 → 158/228, 0 wrong, 0 error — 1.2.1.3:2008 and 1.2.1.6:99; one row moved Unsolved → Timeout at the 5 s cap ((d + ex)^(9/2)/(a^2 + 2abx + b^2x^2)^(3/2), which is a new answer path rather than a loss).
  • Family 6: 377/417, 0 wrong, unchanged. 1774-problem suite: 1707, 0 wrong, 0 timeout, unchanged.
  • Unit suite: 12,665 tests, 0 failed. bench.sh: PASSED on all 19 gated benchmarks.
  • Four forms verified by differentiating back with every symbol pinned, worst relative deviation 0 at five points each.

Part of #718.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

`(A + B x)(d + e x)/(a^2 + 2 a b x + b^2 x^2)^(5/2)` was left as written,
though the radicand is `(a + b x)^2` and the power is `|a + b x|^5`.
Three conditions said no, and each is a different kind of mistake:

The discriminant `4 a^2 b^2 - 4 a^2 b^2` is a zero `InnerSimplified` does
not collect, so a guard asking what it evaluates to read the square as an
ordinary quadratic. The leading coefficient `b^2` is not a number, though
it is positive for a real parameter -- `IsPositiveForARealParameter` is
the library's own answer to that, and the condition `b^2 > 0` travels with
the answer as it does elsewhere. And the rule's bound on how large a
radicand it reads, which is there so that it costs nothing at every level
of the descent, is lifted at the top only: there any half-odd power of a
square is the power of the modulus, while below it the square root alone
is safe, a sign written for a substitution's variable being a factor the
rest of the search has to carry.

The sign goes in front of the integral rather than into the integrand.
Left inside, a rule below differentiates it: `sqrt(a^2 + 2abx + b^2x^2)
sqrt(c + ex + dx^2)` threw `CannotEvalException: derivative(sgn(...))`,
which the corpus found and no probe had.

Family 1 of the Rubi suite: 156 -> 158 of 228, 0 wrong, 0 error; family 6
377/417 and the 1774-problem suite 1707 unchanged. Suite 12665 passed;
allocation gate passed on all 19 gated benchmarks.

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 81e1888 into master Sep 23, 2026
31 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