Skip to content

A root of a square inside a sum is integrated on each side of the square's zero - #1726

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
the-sign-of-a-root-of-a-square-inside-a-sum
Oct 4, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
the-sign-of-a-root-of-a-square-inside-a-sum

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718.

1/(1 + (x^2)^(3/2)) is 1/(1 + x^3) for a positive x and 1/(1 - x^3) for a negative one. The rule for a root of a perfect square writes (x^2)^(3/2) as sgn(x) x^3 and took the sign out in front of the integral, which holds where the root is a factor of the integrand and not inside a sum: the answer was sgn(x) times the first one's, right for a positive x and wrong for every negative one. The rule that takes a square factor out of a root did the same with sqrt(x^6). 2.5.0 declined all of these. Checked with points on both sides of zero, x = ±0.4, ±1.3, ±2.7:

integrand master 959c2d2e this
1/(1 + (x^2)^(3/2)) right for x > 0, wrong for every x < 0 right on both sides
1/(1 + sqrt(x^2)) right for x > 0, wrong for every x < 0 right on both sides
x/(x + sqrt(x^6)) right for x > 0, wrong for every x < 0 right on both sides
1/(2 + sqrt(x^2 + 2x + 1)) right for x > -1, wrong below right on both sides
sqrt(x^2)/(1 + x) right on both sides the same answer

What changes. A sign goes in front of the integral only where every occurrence of the root is a factor of the integrand, as before. Where one stands inside a sum, the root is written with a sign of its own, the integrand is integrated with it 1 and with it -1, and the answer is the piecewise of the two on the sign of the root's linear. More than one such linear, and the rule declines. A root that is a factor keeps its answer: sqrt(x^2)/(1 + x) is sgn(x) (x - ln(1 + x)) as it was.

Tests: RootOfAPerfectSquareIntegralTest.ARootOfASquareInsideASumIsIntegratedOnEachSide, seven rows, each differentiated back at four negative points and three positive ones; all seven fail on master.

Measured first with the corpus's check of the negative side switched on (IB_BOTHSIDES=1), on the 616 problems with a root of a written square in them, at the corpus's 5-second budget, against master 51cb049a, the branch then on it:

master this
answered 561 567
wrong 5 0

The five are 1/(1 + (x^2)^(3/2)) from 1.1.3.2 and four of 1.3.2's with sqrt(x^6) in a sum, x/(x + sqrt(x^6)) among them, each right for a positive x only. The sixth answered is one master ran out of time on.

Measured then on the Rubi corpus against master 8f3757cd, the branch's base:

master this
family 0, independent suites (1814) 1766 1766
family 1, 40 a file (1381) 1296 1297
families 2 to 8, sampled (2410) 2215 2218

No answer is wrong in the sample on either build. The six problems the two builds disagreed on, run again one build at a time, come out the same on both: four answered and two declined.

The suite passes on the commit measured, 4667b70e, 14,598 tests of 14,611 with 13 skipped, run under a 4 GB heap limit, and so does the allocation gate. Master 959c2d2e is merged in since, without conflicts; the calculus tests pass on the merge, 4,010 of 4,011, the other the 30-second clock on declining sin(x)/(x^3 + 1)^2, which ran past it under the machine's load and passes on its own in 4 s, and every row above is as the table says on it.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 2 commits October 3, 2026 23:08
…are's zero

1/(1 + (x^2)^(3/2)) is 1/(1 + x^3) for a positive x and 1/(1 - x^3)
for a negative one, and x/(x + sqrt(x^6)) is 1/(1 + x^2) and
1/(1 - x^2). The rules for a root of a perfect square and for a
square factor taken out of a root wrote the sign of the modulus out
in front of the integral, which holds for a factor of the integrand
and not inside a sum, so the answer was the positive side's on both.
A sign goes in front only where every occurrence of the root is a
factor; otherwise the integrand is integrated with the sign 1 and
with it -1, and the answer is the piecewise of the two.

Part of #718.

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 4, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit b2157e0 into master Oct 4, 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