Repository navigation
A squared sine and cosine with one coefficient are found anywhere in a sum - #2175
Merged
Rafael-SOWNet merged 1 commit intoOct 27, 2026
Merged
Rafael-SOWNet merged 1 commit into
Rafael-SOWNet merged 1 commit into
Conversation
…a sum The gathered Pythagorean rule matches sin(x)^2 and cos(x)^2 wherever they sit in a sum, but only with a coefficient of one. With a coefficient the pair was left to SharedFactor, which sees two siblings, so the sort decided: y + (-2) cos(x)^2 + (-2) sin(x)^2 came out y - 2, and 2 + (-2) cos(x)^2 + (-2) sin(x)^2, where the constant sorts between the two, stayed. #2133's 2 + (-2) cos(2x) + (-4) sin(x)^2 opens to that and stopped there, while 2 - 2 cos(2x) - 4 sin(x)^2 reached 0. squared-sine-and-cosine-with-one-coefficient-sum-to-it gathers k sin(x)^2 and k cos(x)^2 of one argument and one coefficient and writes k: Sound for every complex k and x, two-sided, Collects, and with no backwards reading, since it forgets the angle as the first rule does. The census moves by one in WritingARule.md, Saturation's remark and the tests that pin them; ReversibleRuleTest asks every rule of the set instead of Single(). (cos(2x) - 1)^2 + sin(2x)^2 - 4 sin(x)^2 still stops at 2 + (-2) cos(2x) + (-4) sin(x)^2, which one more Simplify now takes to 0: that is #2133's main point, Simplify not simplifying its own answer, and is not this change. On 2.6.0 and on this branch, Simplify: 2 + (-2)*cos(x)^2 + (-2)*sin(x)^2 unchanged -> 0 2 + (-2) * cos(2 * x) + (-4) * sin(x) ^ 2 unchanged -> 0 Chain against master 966f26a: verdicts identical, 0 moves; performance gate passed on all 19; unit suite 17,159 passed, 0 failed. RuleCheck passes, Confluence and CanonCheck match their baselines, SimpSweep 10,463/10,463. Part of #2133 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2175 +/- ##
=======================================
Coverage 86.44% 86.45%
=======================================
Files 295 295
Lines 64905 64930 +25
Branches 19092 19092
=======================================
+ Hits 56108 56132 +24
+ Misses 4770 4769 -1
- Partials 4027 4029 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was referenced Oct 27, 2026
Rafael-SOWNet
added a commit
that referenced
this pull request
Oct 27, 2026
…e's is (#2177) sin(x)^2 - (1 - cos(2x))/2 simplified to 0 and cos(x)^2 - (1 + cos(2x))/2 did not. Its candidates reach -1/2 + cos(x)^2 / 2 + sin(x)^2 / 2, which is 0, and stopped there: a rational coefficient is written as a divisor, so k sin(x)^2 + k cos(x)^2 = k (#2175) does not see cos(x)^2 / 2, and the two squares are not siblings for the switch's rules either. squared-sine-and-cosine-over-one-divisor-sum-to-its-reciprocal gathers sin(x)^2 / d and cos(x)^2 / d of one argument and one divisor and writes 1 / d: Sound, since both sides are defined exactly where d is not 0, two-sided, Collects, and with no backwards reading, as it forgets the angle. Two different divisors are left alone. The census moves by one in WritingARule.md, Saturation's remark and the tests that pin them. On 2.6.0 and on this branch, Simplify: cos(x)^2 - (1 + cos(2*x))/2 unchanged -> 0 Chain against master 856b3cb: verdicts identical, 0 moves; performance gate passed on all 19; unit suite 17,169 passed, 0 failed. RuleCheck passes, Confluence and CanonCheck match their baselines, SimpSweep 10,463/10,463. Part of #2142 Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Part of #2133: the part where the result depends on how a sum is written.
The defect: the gathered Pythagorean rule matches
sin(x)^2andcos(x)^2wherever they sit in a sum, but only with a coefficient of 1. With a coefficient, the pair was left toSharedFactor, which sees two siblings only, so the order the sum was sorted into decided:y + (-2) cos(x)^2 + (-2) sin(x)^2came outy - 2;2 + (-2) cos(x)^2 + (-2) sin(x)^2, where the constant sorts between the two, stayed as written.#2133's
2 + (-2) cos(2x) + (-4) sin(x)^2opens to that second form and stopped there, while2 - 2 cos(2x) - 4 sin(x)^2reached0.The change: a second rule in the set,
squared-sine-and-cosine-with-one-coefficient-sum-to-it. It gathersk sin(x)^2andk cos(x)^2with the same argument and the same coefficient, and writesk.Soundfor every complexkandx, has a pattern on both sides, and its growth isCollects.2 sin(x)^2 + 3 cos(x)^2, andk sin(x)^2 + k cos(y)^2.The census moves by one in
WritingARule.md, in the remark inSaturation.cs, and in the tests that pin them.ReversibleRuleTestnow checks every rule of the set, where it usedSingle().Simplify2 + (-2)*cos(x)^2 + (-2)*sin(x)^202 + (-2) * cos(2 * x) + (-4) * sin(x) ^ 20Not in this PR:
(cos(2x) - 1)^2 + sin(2x)^2 - 4 sin(x)^2still stops at2 + (-2) cos(2x) + (-4) sin(x)^2, which one moreSimplifynow takes to0. That is #2133's main point,Simplifynot simplifying its own answer. Making it iterate would cost every call whose answer differs from its input, so it needs its own measurement.Checked:
PythagoreanPairWithACoefficientTest: 8 rows. It includes Simplify can stop before its own answer is simplified #2133's two rational rows, which A sum of fractions that is a constant over one denominator simplifies to it #2174 answered.966f26a9f: identical verdicts in all nine families, 0 moves.🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura