Repository navigation
Differentiate the sign and the modulus of an expression in roots where the roots are real - #1988
Merged
Rafael-SOWNet merged 1 commit intoOct 21, 2026
Conversation
…e the roots are real The derivative of sgn(f) and of abs(f) was left unevaluated wherever f is not real on the whole line, and a root of anything that can be negative is not. Where f is real wherever the bases of its roots are positive, the derivative is now a piecewise: the real-line rule, 0 and sgn(f) f', where every such base is positive, and the derivative left as written elsewhere, where a root is imaginary and sgn(z) = z/|z| turns with z. A derivative node no longer simplifies a result that contains itself, which looped. Antiderivatives that carry such a sign -- Rubi's x^(-1 - 3n/2) (b x^n)^(3/2), sqrt(1 + x + sqrt(1 + x)), (x - 4)/((1 + x^(1/3)) sqrt(x)) -- could not be differentiated back anywhere, so a right answer read as unverified. Three answers built under u = sqrt(1 + x) or sqrt(x) lose a provided 1 + x >= 0 attached for want of that derivative. Rubi pocket (3,549 rows of 1.1.3.x, 1.2.4.2 and 1.3.2): 3502 -> 3512 solved; the moves re-run alone go 1 -> 13 verified, none lost; the samples of every family verify three more and lose none. Part of #233. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The derivative of
sgn(f)and ofabs(f)was left unevaluated whereverfis not real on the whole line, and a root of anything that can be negative is not.Where
fis real wherever the bases of its roots are positive, the derivative is now a piecewise:0forsgn, andsgn(f) f'forabs;sgn(z) = z/|z|turns withz.RealValued.WhereRealValuedgives the conjunction ofbase > 0over the powers that are not whole. A derivative node no longer simplifies a result that contains itself; without that guard, this change looped.The integrator's antiderivatives of Rubi's
x^(-1 - 3n/2) (b x^n)^(3/2),sqrt(1 + x + sqrt(1 + x)),(x - 4)/((1 + x^(1/3)) sqrt(x))and their kin carry such a sign. They are right, by quadrature on both sides of their roots, but could not be differentiated back anywhere, so they read as unverified. Three answers built underu = sqrt(1 + x)oru = sqrt(x)lose aprovided 1 + x >= 0that had been attached for want of that derivative.sqrt(1 + x + sqrt(1 + x))keeps the condition of its answer inuinstead, 26 characters longer.Measured on
8270086f, branch against master:Re-run alone, 12 problems go from unverified to verified: 1.1.3.2:211–214, 1.2.4.2:185, 1.3.2:935, 939, 966, 967 and 1228, 4.2.2.1:320 and 5.5.2:64. The 13th move, 7.4.1:369, a problem master answers in 24 s, is answered on both builds. Nothing goes the other way. Across the whole 1.3.2 file and 360 solved root integrands from families 0, 1 and 4–7, the answers are otherwise byte-identical. None of the problems answered on both builds allocates more on the branch. No run had a wrong answer.
ASignOfARootIsFlatWhereTheRootIsRealTesthas 28 cases. The 5,665 calculus, derivative, limit and piecewise tests pass. One cache wall-clock test failed under load at 35 s against its 30 s bound, and passes alone in 3 s.BREAKING-CHANGES.mdhas the entry, with the 2.5.0 column measured on v2.5.0.Part of #233.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura