Skip to content

Keep a family of roots through n = 0, and leave its undefined member out - #2718

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix-2710-periodic-branch-through-n-zero
Dec 5, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
fix-2710-periodic-branch-through-n-zero

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Solving f(g(x)) = c for a periodic f gives a family c n with no offset. A family is judged by its member at n = 0. Through a reciprocal that member is 1/0, and through a root it has arg(0) in its condition. Either one dropped the whole family, so real roots went missing. Where the member was not judged undefined, as in cos(pi/x) = 1, the family kept pi/0.

What changed

  • Inverting a / u = v, u^(-k) = v and u^(-p) = v now keeps v's whole parameter away from where v is 0. This reuses WhereAPowerCanBe, which already writes m in ZZ \ { 0 } for sin(e^x) = 0.
  • IsUndefinedExactly skips a connective whose truth is already decided. 0 = 0 or -pi/2 < arg(0) <= pi/2 is true, so the member (2 pi 0)^2 = 0 counts as a root.
.Solve("x") master (409d688) this branch
tan(1/x) = 0 { } union({ 1 / (pi * n) }, n in ZZ \ { 0 })
sin(1/x) = 0 1/(pi + 2 pi n) only adds union({ 1 / (2 * pi * n) }, n in ZZ \ { 0 })
cos(pi/x) = 1 union({ pi / (2 * pi * n) }, n in ZZ) … n in ZZ \ { 0 }
cos(sqrt(x)) = 1 { } (2 pi n)^2 provided …, so 0, 4 pi^2, …
e^(sqrt(x)) = 1 { } (2 pi i n)^2 provided …, which includes 0
cos(x^(1/3)) = 1 { } (2 pi n)^3, every n, because (-8)^(1/3) = -2
cos(x^(2/3)) = 1 -(2 pi n)^(3/2) provided 2 pi n > 0 adds (2 pi n)^(3/2) for n >= 0, because (-8)^(2/3) = 4 as evaluated

Measured. I checked against mpmath (50 digits) on the sweep's 68 class-A rows, its H rows and 306 variants: ten periodic outer functions and eighteen inner functions, shifted and scaled ones included.

  • 121 answers that were missing roots on master are right now, and so are 11 that had extraneous members.
  • No row that was right on master changed its verdict.
  • The rows the checker still lists as missing need n beyond the range it enumerates (up to ±250000), near the essential singularity at 0.
  • C# unit suite: 22340 passed, 0 failed. F# wrapper: 135 passed.
  • RootCheck: 0 incomplete, 0 unsound, before and after. CasBench: 120/121, the same verdicts row for row.

Fixes #2710

🤖 Generated with Claude Code

Solving f(g(x)) = c for a periodic f gives a family c n with no offset, and a
family is judged by its member at n = 0. Through a reciprocal that member is
1/0, and through a root it carries arg(0) in its condition; each was read as
evidence against the whole family, so real roots went missing: tan(1/x) = 0,
cos(sqrt(x)) = 1, e^(sqrt(x)) = 1 and cos(x^(1/3)) = 1 were { }, sin(1/x) = 0
kept only 1/(pi + 2 pi n), and cos(x^(2/3)) = 1 only its negative roots.
Where the member happened not to be judged undefined, as in cos(pi/x) = 1,
the family kept pi/0.

A reciprocal is never 0, so inverting a / u = v, u^(-k) = v and u^(-p) = v
now takes the whole parameter of v away from where v is 0, as the power of e
already did for sin(e^x) = 0: 1/x = pi n is x = 1/(pi n) for n in ZZ \ { 0 }.
And a connective whose truth is decided is no longer searched for an
undefined node under it: 0 = 0 or -pi/2 < arg(0) <= pi/2 is true, and the
member (2 pi 0)^2 = 0 is a root.

Checked against mpmath on the 68 rows of the sweep's class A, its H rows and
306 variants (ten periodic outer functions, eighteen inner functions
including shifted and scaled ones): 121 missing and 11 extraneous answers on
master are right now, and no row right on master changed verdict. The rows
the checker still lists as missing are roots past the n it enumerates near
the essential singularity at 0. RootCheck and CasBench unchanged.

Fixes #2710

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.66%. Comparing base (409d688) to head (8822816).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2718   +/-   ##
=======================================
  Coverage   86.65%   86.66%           
=======================================
  Files         346      346           
  Lines       76959    76971   +12     
  Branches    22644    22648    +4     
=======================================
+ Hits        66692    66709   +17     
  Misses       5534     5534           
+ Partials     4733     4728    -5     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.15% <100.00%> (+<0.01%) ⬆️
fsharp 32.79% <ø> (ø)
interactive 40.09% <ø> (ø)

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

Files with missing lines Coverage Δ
...nuous/Solvers/EquationSolver/InvertNode.Classes.cs 64.46% <100.00%> (+2.10%) ⬆️
...ontinuous/Solvers/EquationSolver/SolveStatement.cs 84.57% <100.00%> (+0.13%) ⬆️

... and 6 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 2a72476 into master Dec 5, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Dec 5, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the fix-2710-periodic-branch-through-n-zero branch December 5, 2026 18:23
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.

Solving a periodic function of 1/x, sqrt(x) or x^(1/3) drops the branch through n = 0: tan(1/x) = 0 and cos(sqrt(x)) = 1 give { }

1 participant