Skip to content

The power reduction of a squared cosine is proved, as the squared sine's is - #2177

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
squares-of-sine-and-cosine-over-one-divisor-are-found-anywhere
Oct 27, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
squares-of-sine-and-cosine-over-one-divisor-are-found-anywhere

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #2142: the cosine power reduction.

The defect: 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.

The change: a third gathered rule in PythagoreanIdentity, squared-sine-and-cosine-over-one-divisor-sum-to-its-reciprocal. It gathers sin(x)^2 / d and cos(x)^2 / d with the same argument and the same divisor, and writes 1 / d.

  • It is Sound, since both sides are defined exactly where d is not 0.
  • It has a pattern on both sides and its growth is Collects.
  • It has no backwards reading, since it forgets the angle.
  • Two different divisors are left alone.

The census moves by one in WritingARule.md, in the remark in Saturation.cs, and in the tests that pin them.

Simplify 2.6.0 this PR
cos(x)^2 - (1 + cos(2*x))/2 unchanged 0

Checked:

  • PowerReductionTest: 5 rows.
  • The intbench chain against master 856b3cb6b: identical verdicts in all nine families, 0 moves.
  • Performance gate: passed on all 19 gated benchmarks.
  • Unit suite: 17,169 passed, 0 failed.
  • RuleCheck passes; Confluence and CanonCheck match their baselines; SimpSweep 10,463/10,463.
  • BREAKING-CHANGES entry added, measured on the 2.6.0 package.

Still open on #2142: the tangent addition formula, half-angle, Weierstrass, sum-to-product and product-to-sum identities.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

…e's is

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet added this to the 2.7.0 milestone Oct 27, 2026
@Rafael-SOWNet Rafael-SOWNet moved this from Todo to In review in AngouriMath Oct 27, 2026
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.45%. Comparing base (856b3cb) to head (020354c).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2177      +/-   ##
==========================================
- Coverage   86.45%   86.45%   -0.01%     
==========================================
  Files         295      295              
  Lines       64969    64995      +26     
  Branches    19092    19092              
==========================================
+ Hits        56171    56193      +22     
- Misses       4770     4775       +5     
+ Partials     4028     4027       -1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.02% <100.00%> (-0.01%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 40.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...Math/Core/Transformations/Matching/MatchedRules.cs 99.58% <100.00%> (+<0.01%) ⬆️
...ces/AngouriMath/Core/Transformations/Saturation.cs 93.33% <ø> (ø)

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit 9ade6c9 into master Oct 27, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Oct 27, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the squares-of-sine-and-cosine-over-one-divisor-are-found-anywhere branch October 28, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant