Skip to content

The integral over the root of a square quadratic is its modulus's, not the table's - #1672

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
the-root-of-a-square-quadratic-is-its-modulus
Oct 2, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
the-root-of-a-square-quadratic-is-its-modulus

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Closes #1670.

The table's entry for k/sqrt(Q) and sqrt(Q) reads any quadratic Q = A x^2 + B x + C by the sign of A. When Q is a square that breaks: the arcsine divides by sqrt(B^2 - 4 A C), which is zero, and the logarithm is of 2 A (x + h) + 2 A |x + h|, which is zero on one side of the root. 1/((x - p) sqrt(Q)) writes Q in t = 1/(x - p), still a square, and asks the same entry.

The root of a square is the modulus of a linear, sqrt(A (x + h)^2) = sqrt(A) |x + h|, and the rule for a root of a perfect square already writes that. Now:

  • The entry does not read a quadratic whose discriminant is zero, so the perfect-square rule gets it.
  • The perfect-square rule takes a leading coefficient that is negative for a real parameter, -b^2 among them. sqrt(A s) = sqrt(A) sqrt(s) holds for any A when s is not negative, so the root of -(a + b x)^2 is sqrt(-b^2) |x + a/b|, and b^2 > 0 travels with the answer.
  • The discriminant is evaluated with its symbols pinned first and simplified only where it is zero there, since the table asks this of every quadratic under a root it meets.

Compared at points on both sides of each root, a = 1.3, b = 0.7, c = 0.6, d = 1.9, h = 1.1:

integrand master this
1/sqrt(x^2 + 2 x + 1) no value for x < -1 sgn(x + 1) ln(x + 1)
sqrt(x^2 + 2 x + 1) no value for x <= -1 sgn(x + 1) (x^2/2 + x)
3/sqrt(9 x^2 - 6 x + 1) no value for x < 1/3 right
1/sqrt(-4 - 4 x - x^2) NaN sgn(x + 2) ln(i x + 2 i)/i
sqrt(-4 - 4 x - x^2) NaN i sgn(x + 2) (x^2/2 + 2 x)
1/sqrt(-a^2 - 2 a b x - b^2 x^2) NaN right
x/sqrt(-a^2 - 2 a b x - b^2 x^2) declined right
1/(x sqrt(-a^2 - 2 a b x - b^2 x^2)), Rubi 1.2.1.2 #2737 NaN right
1/(x sqrt(a^2 + 2 a b x + b^2 x^2)) no value between the roots right
1/((d + h x) sqrt(a^2 + 2 a b x + b^2 x^2)) no value between the roots right
1/((d + h x) sqrt(-a^2 - 2 a b x - b^2 x^2)) NaN right
1/(x sqrt(c (a + b x)^2)) no value between the roots declined

The last is declined because c has no known sign, so its square is not read as one.

Tests: RootOfAPerfectSquareIntegralTest.TheTableDoesNotReadASquareAsAQuadratic, eleven rows, and ASquareOfUnknownSignIsNotAnsweredWrongly, which takes a decline or an answer that holds everywhere. They compare at every point where the integrand has a value, so an answer with no value there fails instead of being skipped. All twelve fail on master.

Measured on the Rubi corpus against master 94ba5ff6, which has the same library as master now, with both builds side by side:

master this
family 0, independent suites (1814) 1758 1758
families 1 to 8, sampled (3967) 3480, 3 wrong 3482, 1 wrong
Rubi 1.2.3.2, the 179 whose trinomial is a square 107, 2 wrong, 8 past the budget 103, 0 wrong, 0 past the budget

Five problems moved in the sample, and I re-ran each alone on both builds:

The four squares in 1.2.3.2 that master answers and this branch does not are #111, #574, #598 and #607. On master each has no value at 3 to 6 of 6 points when a b < 0, where the integrand has one. The corpus binds a and b to positive numbers, so it counted them as solved. The two wrong there, #645 and #647, are declined here too. 2.5.0 declines all six, so none of them changes against the release.

The suite passes, 14,324 tests on a fresh build, and so does the allocation gate.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 2 commits October 2, 2026 07:20
…t the table's

The table's entry for k/sqrt(Q) and sqrt(Q) takes a quadratic apart by
the sign of its leading coefficient. The arcsine arm divides by the root
of the discriminant, and the logarithm arm takes ln|2ax + b + 2 sqrt(a)
sqrt(Q)|, which is ln(0) on one side of the root when Q is a square:
1/sqrt(x^2 + 2x + 1) was ln(0) for every x below -1, and
1/sqrt(-a^2 - 2abx - b^2 x^2) NaN at every x. A linear beside the root
writes Q in t = 1/(x - p), still a square, and asked the same entry.

- The entry does not read a quadratic whose discriminant vanishes. Its
  root is the modulus of a linear, which the rule for a root of a
  perfect square writes.
- That rule takes a leading coefficient negative for a real parameter
  too, since sqrt(a (x + h)^2) is sqrt(a) |x + h| for either sign:
  -a^2 - 2abx - b^2 x^2 is answered with sqrt(-b^2) and b^2 > 0.
- The discriminant is tested with its symbols pinned first, and
  simplified only where it is zero there.

Closes #1670.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Measured on the 2.5.0 tag and on this branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
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.

The integral over the root of a quadratic that is a square is NaN, or ln(0) beyond its root

1 participant