Repository navigation
Keep a sum of piecewise answers a sum where their cases do not line up - #1882
Merged
Merged
Conversation
An answer's sum of two piecewises was combined case by case into one piecewise with every case of one against every case of the other. It stays a sum where that combination has more cases than the two together, counted after the unreachable ones are gone; and a sum holding a piecewise is not copied into another's cases. Integrands are normalised with the old combination, so the search sees what it saw before. Fixes #1874 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
…answers-stays-a-sum
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.
Fixes #1874. Part of #718
An antiderivative whose terms each split on the signs of their constants was combined into one piecewise, listing every case of one term against every case of the other.
CombinedCaseByCasenow leaves a sum or a difference as a sum of the two piecewises wherever combining them would give more cases than the two have between them. The count is taken after unreachable cases are removed, so #1414's three-plus-three-to-five combinations still happen. A sum that already holds a piecewise is not copied into the cases of another piecewise.Integrands are not affected:
Normalizedcombines a sum of piecewises the old way while it runs, so the search sees the shapes it saw before. Without that, a by-parts remainderu' v, withva sum of piecewises, was split term by term and each term searched, and(a + b atanh(c x^2))^2/x^5went from 19 s to 134 s.Measured
1/(b x^2 + m) - 1/(sqrt(a + b x^2) (b x^2 + m))(A + B x)(d + k x)^(7/2)/(b x + c x^2)^3(1.2.1.3:1395)(A + B x)/((d + k x)^(5/2) (b x + c x^2)^3)(1.2.1.3:1401)(a + b x + c x^2)^(3/2)/((d + k x)(f + g x)^3)(#1881)(a + b x^2 + c x^4)^(3/2)/(x^3 (d + k x^2))(#1881)asec(a + b x)/x^4(#1881)I ran intbench against master (#1881's head, same tree as 790feec) with a 5 s budget. The pocket was 1.2.1.2–1.2.1.4, 1.2.1.9, 1.2.2.2, 1.2.2.4, 1.3.2, 3.5, 5.5.2, 5.6.2 and 7.3.2 in full (7,699 rows), plus the usual family sample:
Nine rows moved:
(a + b atanh(c/x^2))^2/x^5, went from solved to timeout. Timed alone, it gives the same 283-character answer in 36–39 s on master and 61–62 s here. The by-parts remainders it declines now hold the inner antiderivative written as a sum, and the declines cost more. 7.3.2:89, the same shape withc x^2, went the other way, from 19 s to 14 s.The gate passes. Two tests read a sum of piecewises as one piecewise:
ContradictoryConjunctionTest.OppositeSignsStay…tests the pruning inCombinedCaseByCase, so it now asks a product, which still combines.UnreachablePiecewiseCaseTestis what moved the count to after the unreachable cases are removed.The suite passes in two runs, 13,521 and 1,856, which is master's 15,373 plus the 4 new tests. Run whole, the test host is killed by the 8 GB memory guard on this branch and on master alike: master's whole suite peaked at 7,947 MB and was killed in one of two runs.
Tests.Conveniencealone peaks at 5.8 GB on master, andDocumentationExamplesRunTestat 2.5 GB.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura