Skip to content

One and a squared tangent are found anywhere in a sum - #2176

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
one-and-a-squared-tangent-are-found-anywhere-in-a-sum
Oct 27, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
one-and-a-squared-tangent-are-found-anywhere-in-a-sum

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Part of #2142: 1 + tan(x)^2 = sec(x)^2, the second pair in its table.

The defect: 1 + tan(x)^2 = sec(x)^2 and 1 + cot(x)^2 = csc(x)^2 are rules in TrigonometricRules for two siblings, so the sort decides whether the 1 and the square meet.

  • Secant sorts before tangent, so 1 + tan(x)^2 - sec(x)^2 became 1 - sec(x)^2 + tan(x)^2 and stayed.
  • Cotangent sorts before cosecant, so its twin was 0 provided not sin(x) = 0.

The change: both identities are added to PythagoreanIdentity as gathered rules. That set already finds sin^2 + cos^2 wherever the two terms sit in a sum, and #2175 did the same with a coefficient.

  • They are SoundUnderAssumptions, as the sibling rules are, since each side is defined only where cos (sin) is not 0.
  • Each has a pattern on both sides, is reversible, has growth Collects, and carries its identity.

The census moves by two in WritingARule.md, in the remark in Saturation.cs, and in the tests that pin them. ReversibleRuleTest's hole-dropping check now names the two Pythagorean rules instead of every rule of the set, because these two keep their argument.

Simplify 2.6.0 this PR
1 + tan(x)^2 - sec(x)^2 unchanged 0 provided not cos(x) = 0
a + 1 + tan(y)^2 - sec(y)^2 unchanged a provided not cos(y) = 0

Still open on #2142:

  • The tangent addition formula, half-angle, Weierstrass, sum-to-product and product-to-sum identities.
  • The cosine power reduction cos(x)^2 - (1 + cos(2x))/2, whose sine twin is answered. Its candidates reach -1/2 + cos(x)^2/2 + sin(x)^2/2, and the two squares there are quotients rather than products, so neither Pythagorean rule matches them.

Checked:

  • TangentSecantIdentityTest: 5 rows.
  • The intbench chain against master c90db9f13: identical verdicts in all nine families, 0 moves.
  • Performance gate: passed on all 19 gated benchmarks.
  • Unit suite: 17,164 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.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

1 + tan(x)^2 = sec(x)^2 and 1 + cot(x)^2 = csc(x)^2 are rules in
TrigonometricRules for two siblings, and the sort decides whether the 1
and the square are siblings. Secant sorts before tangent, so
1 + tan(x)^2 - sec(x)^2 became 1 - sec(x)^2 + tan(x)^2 and stayed, while
1 + cot(x)^2 - cosec(x)^2, where cotangent sorts before cosecant, was
0 provided not sin(x) = 0. #2142 has the pair.

Both identities are added to PythagoreanIdentity as gathered rules, as
that set already finds sin^2 + cos^2 wherever the two terms sit:
SoundUnderAssumptions as the sibling rules are, since each side is
defined only where cos (sin) is not 0, two-sided, reversible, Collects,
and each with its identity. The census moves by two in WritingARule.md,
Saturation's remark and the tests that pin them; ReversibleRuleTest's
hole-dropping check names the two Pythagorean rules rather than every
rule of the set, since these two keep their argument.

On 2.6.0 and on this branch, Simplify:
  1 + tan(x)^2 - sec(x)^2      unchanged -> 0 provided not cos(x) = 0
  a + 1 + tan(y)^2 - sec(y)^2  unchanged -> a provided not cos(y) = 0
Chain against master c90db9f: verdicts identical, 0 moves; performance
gate passed on all 19; unit suite 17,164 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.46%. Comparing base (c90db9f) to head (9150b4d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2176      +/-   ##
==========================================
+ Coverage   86.44%   86.46%   +0.01%     
==========================================
  Files         295      295              
  Lines       64930    64969      +39     
  Branches    19092    19092              
==========================================
+ Hits        56130    56176      +46     
+ Misses       4771     4765       -6     
+ Partials     4029     4028       -1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.03% <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.57% <100.00%> (+<0.01%) ⬆️
...ces/AngouriMath/Core/Transformations/Saturation.cs 93.33% <ø> (ø)

... and 5 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 856b3cb 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 one-and-a-squared-tangent-are-found-anywhere-in-a-sum 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