Skip to content

A conditional expression is differentiated where its condition holds - #1685

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-conditional-answer-is-differentiated-under-its-condition
Oct 2, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-conditional-answer-is-differentiated-under-its-condition

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #718.

F provided P is differentiated with P known to hold, and so is each case of a piecewise. The derivative is claimed only there anyway. A power whose base the known condition keeps positive is read as real. So under a strict bound such as x > 0, the sign, the modulus, max and min of an expression in a root of x differentiate as on the real line:

2.5.0 and master this
sgn(x^(1/3) + 2) provided x > 0 derivative(sgn(x ^ (1/3) + 2), x) provided x > 0 0 provided x > 0 and not x ^ (1/3) + 2 = 0
abs(sqrt(x) - 1) provided x > 0 derivative(abs(sqrt(x) - 1), x) provided x > 0 sgn(sqrt(x) - 1) * 1/2 * x ^ (-1/2) provided ...: 1/4 at 4, -1 at 1/4

Without the bound nothing changes, since for x < 0 the roots are complex. Only a strict bound is read: under x >= 0 there is no interval of positive x around 0.

This is what lets an answer of the form sgn(x^(1/3) + a/b) F(x) provided x > 0 be checked by differentiating it back. The next PR integrates such squares.

Tests: DerivativeGapsTest.UnderItsConditionARootIsReal (six rows, a piecewise and max among them) and WithoutAStrictConditionARootIsNotReadAsReal (three).

Measured on the Rubi corpus against master fb520e20, with both builds side by side. Both arms run a corpus runner that differentiates an answer with its condition and strips it after; on master that is the same as stripping first:

master this
family 0, independent suites (1814) 1758 1758
family 1, 40 a file (1381) 1119 1119
families 2 to 8, sampled (2586) 2362 2364

Two problems moved, one in family 3 and one in family 6, each past the budget on one build only. Re-run alone, both are past the budget on both builds, so the corpus does not change. That is expected of a change to differentiation: the integrals with such conditions in their answers are the next PR's.

The one wrong answer in family 7 is the same on both builds: 7.4.2's e^(2 acoth(a x)) sqrt(c - a c x)/x, which #1682 fixed on master after this branch's base.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

`F provided P` is differentiated with P known to hold, and so is each case of a piecewise, since
the derivative is claimed only there. A power whose base what is known keeps positive is read as
real, so under a strict bound such as `x > 0` the sign, the modulus, max and min of an
expression in a root of x differentiate as on the real line: sgn(x^(1/3) + 2) provided x > 0 is
0 there, where it was left as written. Without the bound nothing changes, since for x < 0 the
roots are complex.

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 merged commit c3f5269 into master Oct 2, 2026
34 checks passed
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 2, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-conditional-answer-is-differentiated-under-its-condition branch October 29, 2026 00:43
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