Skip to content

A coefficient that is zero as a value is no degree, nor a root - #1682

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
an-antiderivative-is-not-nan
Oct 2, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
an-antiderivative-is-not-nan

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Closes #1665.

Both NaN answers come from a coefficient that is zero as a value and not as written. The radical substitution leaves such coefficients behind when the integrand has symbols for its coefficients.

  • e^(3 acoth(a x))/(c - a c x)^3, under the root of the quotient, is u^4 (a - a u^2) over (-(a - a u^2) + -(u^2 + 1) a)^3, which is -8 a^3. The long division reads its divisor's degree off the divisor expanded. Expand writes (u^2)^2 beside u^4, and u^2 (u^2)^2 beside u^6, and the coefficients it reads off are -6 a^3 + 6 a^3 and -3 a^3 + 3 a^3. Neither InnerSimplified nor Evaled collects those, so the division took a sextic with leading coefficient -3 a^3 + 3 a^3, divided by it, and the quotient was NaN.
  • e^(2 acoth(a x)) sqrt(c - a c x)/x leaves ((c - u^2)/c - 1)(u^2 - c), which is -u^2 (u^2 - c)/c. Its constant term reads as -(c/c - 1) c, which is zero, so one of its roots in u^2 is zero too. SolveAnEvenPolynomialOverASymbolicBiquadratic answered it with atan(u/sqrt(r))/sqrt(r) at r = 0. That is where -(2 * 1/c * c - 1) + 1 came from, and why Simplify turned the answer into NaN.

PartialFractions.IsZeroAsAValue decides zero the way InLowestTermsOverTheSymbols already does: over one bar, the numerator expanded is zero as written, as a number, or at two sets of pinned symbols. The long division now drops leading coefficients of the divisor that are zero that way. The biquadratic rule now declines a constant term, leading coefficient or discriminant that is zero that way, and the rules behind it answer instead.

All five of the issue's integrals now answer:

e^(3*acoth(a*x))/(c-a*c*x)^3   =>   -4 a^4 (1/(8 a^2) q^7/7 - 1/(8 a^2) q^5/5)/(-a c)^3,   q = sqrt((a x + 1)/(a x - 1))

and each answer's derivative agrees with its integrand at real points where the integrand is real, for c of either sign.

Tests:

  • ACoefficientThatIsZeroAsAValueIsReadAsZero checks the derivative of each answer against the integrand, with a and c pinned and c of both signs, and checks that no NaN appears.
  • LongDivisionLeadingCoefficientTest divides by the substitution's own divisor and checks the quotient and remainder by value. It also has the zero and nonzero cases of IsZeroAsAValue.

Without the fix, 10 of the 13 fail. The other 3 are the nonzero cases.

Measured on the Rubi corpus against master 38974356, which has the same library as this branch's base 422c7112, with both builds side by side:

master this
family 7, inverse hyperbolic functions (4289) 3675, 22 wrong 3679, 17 wrong
family 0, independent suites (1814) 1758 1758
families 1 to 6, sampled (2877) 2446 2446

Seven problems moved, and I re-ran each alone on both builds:

All 17 still wrong in family 7 are in 7.3.6. They are the e^atanh shapes that #1663 and #1669 fixed on master after this branch's base.

The suite passes, 14,316 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 01:53
With symbols for its coefficients, the radical substitution leaves coefficients that are zero as
values and not as written. `e^(3 acoth(a x))/(c - a c x)^3` becomes `u^4 (a - a u^2)` over
`(-(a - a u^2) + -(u^2 + 1) a)^3`, which is `-8 a^3`; expanded, it leaves `-3 a^3 + 3 a^3` at `u^6`,
which nothing collects, and the long division divided by that and answered NaN.
`e^(2 acoth(a x)) sqrt(c - a c x)/x` leaves `((c - u^2)/c - 1)(u^2 - c)`, whose constant term
`-(c/c - 1) c` is zero, and the biquadratic rule took one of its roots in `u^2` to be zero.

`PartialFractions.IsZeroAsAValue` decides zero the way `InLowestTermsOverTheSymbols` does: over one
bar, the numerator expanded is zero as written, as a number, or at two sets of pinned symbols. The
long division drops a leading coefficient of the divisor that is zero so, and the biquadratic rule
declines a constant term, leading coefficient or discriminant that is.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
… c x

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.

e^(k acoth(a x)) beside a power of c - a c x is integrated to NaN

1 participant