Repository navigation
A closed form reads as the book writes it - #1597
Merged
Merged
Conversation
A polynomial sum's closed form is multiplied out where that rates simpler, where it is made: the sum of the first n odd numbers is n^2, where it was 2 n + (n - 1)^2 - 1, and Sullivan and Mackey's Prob 5.7.16 is 3 n^2, while sum(k, k, 1, n) keeps (n + n^2)/2. And the condition that a range is not empty, written as the ends left it (n - 1 >= -1), is a bound on the one name the ends are about, n >= 0, written by one helper the seven closed forms share; with two names it is left as it was. Part of #1409. 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 sum of the first
nodd numbers came out aspiecewise((2 * n + (n - 1) ^ 2 - 1) provided (n - 1 >= -1), 0 provided True). Sullivan and Mackey write itn^2, and the condition meansn >= 0. Prob 5.7.16'ssum(2 k + 1, k, n, 2 n - 1)came out as2 * n + (2 * n - 1) ^ 2 - (n - 1) ^ 2under2 * n - 1 >= n - 1, where the book writes3 n^2.Two changes, both where the closed form is made:
PolynomialSummation.Simplest). A polynomial sum's closed form, and a polynomial times a power's, is kept expanded where itsSimplifiedRateis lower. So the odd-number sums aren ^ 2and3 * n ^ 2, whilesum(k, k, 1, n)keeps(n + n ^ 2) / 2.Simplifyis untouched. Making it expand under conditions got the same forms, but it madeSimplifyEasyallocate 5.4% more, because that benchmark'sx ^ 0becomes1 provided not x = 0, and expanding every conditional polynomial made each one a fresh candidate.PolynomialSummation.NonEmptyandAtLeast, shared by the seven closed-form routines). A range is not empty whereto >= from - 1, which was written as the ends left it. Where the two ends are about one name, it is now a bound on that name:n - 1 >= -1isn >= 0, andproduct(2^k, k, 0, n - 1)'sn - 1 >= 0isn >= 1. With two names it is left as it was,n >= m - 1.AClosedFormReadsAsTheBookWritesItandTheRangeConditionIsABoundOnItsNamepin both, with the printed form asserted, since the printed form is the point here.Suite: 13,750 passed, 0 failed on net10.0, and every target framework builds. Gate: passed, with allocation as the baseline says on all 19 gated benchmarks (SimplifyEasy at 79,010 B).
BREAKING-CHANGES.mdhas the entry, after the one for products of powers of one base, whoseproduct(2^k, k, 0, n - 1)row now readsn >= 1, and 2.5.0 is measured.Part of #1409.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura