Skip to content

A trigonometric identity is decided over the sines and cosines of its base angles - #2179

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-trigonometric-identity-is-decided-over-its-base-angles
Oct 28, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-trigonometric-identity-is-decided-over-its-base-angles

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

The tangent addition formula, the half-angle formulas, the Weierstrass forms and sum-to-product came back from Simplify unchanged. Each needs an angle opened, doubled or halved and the Pythagorean pair taken, in one order, and the rules take those a step at a time.

This decides them all in one procedure, TrigonometricIdentity.TryConstant. It applies to a rational function of the six trigonometric functions whose angles are rational combinations of its variables with no constant term:

  • each variable's base angle is the variable over the least common denominator of its coefficients, so every angle is a whole combination of base angles;
  • every sine and cosine is then a polynomial in the base angles' sines and cosines: a Chebyshev polynomial for a multiple, the addition theorem for a sum;
  • the expression is a quotient of polynomials over Q, and with each sin(u)^2 written as 1 - cos(u)^2 a polynomial's form is unique (the relations' leading monomials are coprime, so they are a Gröbner basis);
  • so the quotient is the constant k exactly when the numerator's form is k times the denominator's.

Both theorems hold for every complex angle. Simplify offers the constant as a candidate, with the expression's own domain as its condition, as it does for a - a. It is skipped where the rules already reached the same answer, so that a derivation still records their steps.

Input Was (2.6.0) Now
tan(s + t) - (tan(s) + tan(t))/(1 - tan(s)*tan(t)) unchanged 0 provided not cos(s + t) = 0 and not 1 - tan(s) * tan(t) = 0 and not cos(s) = 0 and not cos(t) = 0
sin(a/2)^2 - (1 - cos(a))/2 unchanged 0
tan(a/2) - sin(a)/(1 + cos(a)) unchanged 0 provided not cos(a / 2) * (cos(a) + 1) = 0
sin(a) - 2*tan(a/2)/(1 + tan(a/2)^2) unchanged 0 provided not 1 + tan(a / 2) ^ 2 = 0 and not cos(a / 2) = 0
sin(a) + sin(b) - 2*sin((a + b)/2)*cos((a - b)/2) unchanged 0
(1 - cos(a))/(1 + cos(a))/tan(a/2)^2 (1 - cos(a)) / ((cos(a) + 1) * tan(a / 2) ^ 2) 1 provided not cos(a) + 1 = 0 and not tan(a / 2) = 0 and not cos(a / 2) = 0
(cos(2*x) - 1)^2 + sin(2*x)^2 - 4*sin(x)^2 (#2133) 2 + (-2) * cos(2 * x) + (-4) * sin(x) ^ 2 0

With this, every identity #2142 lists is proved. The product-to-sum formulas and the cosine power reduction already were, since #2161 and #2177. #2133's trigonometric row reaches 0 too. Its other three rows were answered by #2174, so every row of its table is now answered.

Declined, by design: an angle with a constant term, a named constant such as pi, or an irrational coefficient. The decision needs the Pythagorean relation to be the only one, and sin(pi) = 0 is another. The rules settle these.

Measured

  • Suite: 17203 passed, 0 failed, 13 skipped (the chain's run, on the code as pushed; the Simplify can stop before its own answer is simplified #2133 test row added after it passes on its own).
  • Harnesses: RootCheck 596/596, CasBench 120/121 with 0 wrong, BoundCheck 0 disagreements, SimpSweep 10463/10463, RuleCheck clean; Confluence (3) and CanonCheck (2091) match their baselines. All equal to master's.
  • Intbench chain against master 257f88b: family 1 at 40 a file, family 0 whole, families 2–8 sampled: identical on every family, 0 moves.
  • Performance gate: passed on all 19 gated benchmarks. SimplifyHard reads +2.4% and SolveMediumHard +1.8% against the baseline. Counted directly on this machine, master allocates the same on both inputs (161.85 MB and 1.437 MB a call, within 0.03%), so neither figure is this change.

Closes #2142. Part of #2133.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

… base angles

The tangent addition formula, the half-angle formulas, the Weierstrass forms and
sum-to-product came back from Simplify unchanged. Each needs an angle opened, doubled or
halved and the Pythagorean pair taken, in one order, and the rules take those a step at a
time.

TrigonometricIdentity decides whether a rational function of the six trigonometric
functions is a constant, where its angles are rational combinations of its variables with no
constant term. A variable's base angle is the variable over the least common denominator of
its coefficients, so every angle is a whole combination of base angles, and every sine and
cosine is a polynomial in their sines and cosines: a Chebyshev polynomial for a multiple, the
addition theorem for a sum. The expression is then a quotient of polynomials over Q. With
each sin(u)^2 written as 1 - cos(u)^2 a polynomial's form is unique, the relations' leading
monomials being coprime, so the quotient is the constant k exactly when the numerator's form
is k times the denominator's. Both theorems hold for every complex angle.

Simplify offers that constant as a candidate, with the expression's own domain as its
condition, and not where the rules already reached it, so that a derivation still records
the rules' steps.

Closes #2142. Part of #2133.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.67633% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.42%. Comparing base (257f88b) to head (7a53b33).

Files with missing lines Patch % Lines
...tions/Algebra/Polynomials/TrigonometricIdentity.cs 78.60% 20 Missing and 20 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2179      +/-   ##
==========================================
- Coverage   86.46%   86.42%   -0.04%     
==========================================
  Files         295      296       +1     
  Lines       65014    65221     +207     
  Branches    19099    19165      +66     
==========================================
+ Hits        56214    56370     +156     
- Misses       4767     4802      +35     
- Partials     4033     4049      +16     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 86.99% <80.67%> (-0.04%) ⬇️
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 Δ
...ouriMath/Functions/Simplification/Simplificator.cs 96.49% <100.00%> (+0.21%) ⬆️
...tions/Algebra/Polynomials/TrigonometricIdentity.cs 78.60% <78.60%> (ø)

... and 7 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 766e34b into master Oct 28, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Oct 28, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-trigonometric-identity-is-decided-over-its-base-angles branch October 28, 2026 19:21
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.

cos(s + t) and 1 + tan(x)^2 = sec(x)^2 are not proved, though their sine and cotangent twins are

1 participant