Skip to content

A sine or cosine with no real radical form stays as written - #2308

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-trigonometric-value-with-no-real-radical-stays-as-written
Nov 1, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-trigonometric-value-with-no-real-radical-stays-as-written

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

A sine or cosine whose only radical form goes through the complex numbers (casus irreducibilis) now stays as the function of its angle. A value with a real radical form still takes it.

Simplify master and 2.6.0 now
sin(pi/7) sqrt((1 - 1/6 * (-1 + ((7 + 21 * sqrt(-3)) / 2) ^ (1/3) + ((7 - 21 * sqrt(-3)) / 2) ^ (1/3))) / 2) sin(pi / 7)
cos(2 pi/9) (((sqrt(-3) - 1) / 2) ^ (1/3) + (-(sqrt(-3) + 1) / 2) ^ (1/3)) / 2 cos(2/9 * pi)
sin(pi/18) sqrt((1 - 1/4 * ((4 + 4 * sqrt(-3)) ^ (1/3) + (4 - 4 * sqrt(-3)) ^ (1/3))) / 2) sin(pi / 18)
sin(pi/5) 1/4 * sqrt(10 - 2 * sqrt(5)) the same
  • A table value written through a number that isn't real, i or the square root of a negative number, is now passed over. Every angle in the tables is real, so those are exactly the casus irreducibilis entries. They stay in the tables, so the closed forms stay on record.
  • TrigonometricTableTest's sweep has a floor on how many angles resolve, to catch entries being lost silently. These are lost on purpose, so the floor moves from 690 to 642.
  • Six of CasusIrreducibilisTest's cases fail on master. The suite, the trio, F#, AOT and the eight harnesses pass.

Fixes #2143.

🤖 Generated with Claude Code

Simplify wrote sin(pi/7) as the half angle of the table's cos(2pi/7),
sqrt((1 - 1/6 * (-1 + ((7 + 21 sqrt(-3))/2)^(1/3) + ((7 - 21 sqrt(-3))/2)^(1/3))) / 2),
many times longer than the input. That is casus irreducibilis: the
value is real and no real radical form of it exists, so the only one
goes through the complex numbers. cos(2pi/9) and sin(pi/18) were
written the same way.

A table value written through a number that is not real, i or a square
root of a negative number, is now passed over, and the call is left as
written. Every angle in the tables is real, so such a value is exactly
one of these. The entries stay in the tables, so the closed forms stay
on record. A value with a real radical form, sin(pi/5) among them,
still takes it.

TrigonometricTableTest's sweep counted 690 angles resolved, against a
floor meant to catch entries lost silently; these are lost on purpose
and 642 resolve, so the floor is 642. CasusIrreducibilisTest takes
seven such values, six of which master rewrote, three that still take
their radicals, and sin(pi/7)^2 + cos(pi/7)^2. The suite, the trio,
F#, AOT and the eight harnesses pass.

Fixes #2143.

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

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.76%. Comparing base (5d973db) to head (439f308).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2308      +/-   ##
==========================================
- Coverage   86.77%   86.76%   -0.01%     
==========================================
  Files         311      311              
  Lines       68025    68027       +2     
  Branches    19758    19759       +1     
==========================================
- Hits        59028    59024       -4     
- Misses       4875     4882       +7     
+ Partials     4122     4121       -1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.31% <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 Δ
...nctions/Simplification/TrigonometricTableValues.cs 98.15% <100.00%> (+0.02%) ⬆️

... 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 df991d3 into master Nov 1, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in AngouriMath Nov 1, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-trigonometric-value-with-no-real-radical-stays-as-written branch November 1, 2026 00:37
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.

Simplify writes sin(pi/7) as cube roots of complex numbers, many times longer than the input

1 participant