Skip to content

Drop a circle of roots of a modulus only when none of its members is a root - #2727

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
fix-2712-sqrt-abs-negative
Dec 6, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
fix-2712-sqrt-abs-negative

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

sqrt(abs(x)) = -1 is raised to abs(x) = 1, and its roots e^(i r) were answered. The verification after solving checks each root by substituting it. It judges a family over the integers by one member, but it kept any family with a real parameter. So the roots that raising added stayed in the answer.

Where every x in the equation is inside one modulus |u|, the equation is a function of |u|, which is c wherever u = c e^(i r). Verdict now judges such a family at its members at the angles 0, pi/2, pi, -pi/2, pi/4, 3pi/4, 1 and 2 (SolutionParameters.AtAMember(root, angle)). It keeps the family if any member that has a value is a root, and drops it only if none is. A member where the root is undefined, or where its own provided condition excludes it, counts as no evidence either way. A family with no defined member is kept. Every member is not equally good, because the inverse of what is inside the modulus can be one branch of many: abs(arctan(x)) = 2 is answered tan(2 e^(i r)), whose member tan(2) at r = 0 fails (arctan(tan 2) = 2 - pi) while i tanh(2) at r = pi/2 is a root. Likewise abs((x + 1)/(x - 1)) = 1 is answered -(e^(i r) + 1) / (1 - e^(i r)), the imaginary axis, which has no value at r = 0. Nothing else changes.

.Solve("x") master 409d68805 this branch
sqrt(abs(x)) = -1 { e^(i r_1) provided r_1 in RR } { }
sqrt(abs(x - 4) - 3) = -5 { 28 e^(i r_1) + 4 … } { }
sqrt(abs(x) + 1) = -1 { 0 provided r_1 in RR } { }
abs(x)^(1/4) = -1, abs(x)^(3/2) = -8 a circle { }
sqrt(abs(x)) = abs(x) - 2 circles of radius 1 and 4 radius 4 only
sqrt(abs(x)) = -abs(x) 0 and the unit circle 0 only
sqrt(abs(x)) = 2, abs(x) = 4, abs(x)^(3/2) = 8, sqrt(abs(x-4)-3) = 5 a circle unchanged
sqrt(x) = -1, abs(x) = -1, sqrt(abs(x)) = a unchanged
abs((x + 1)/(x - 1)) = 1, abs((x + 2)/(x - 2)) = 1 the imaginary axis unchanged (an earlier head of this PR answered { })
abs(arctan(x)) = 2, abs(arcsin(x)) = 3 tan(2 e^(i r_1)), sin(3 e^(i r_1)) unchanged (an earlier head of this PR answered { })

What was measured:

  • mpmath check (dps 50). Every dropped family's members fail the equation at several angles: the residual is 2 for sqrt(abs(x)) = -1 and 10 for the second issue row. Every kept family's members have a residual of 0. A complex grid search finds no root for the { } rows.
  • Generated sweep. 90 equations covering sqrt, 4th, 6th, 3/4, 3/2 and 1/3 powers of moduli of linear and quadratic arguments, with negative, imaginary, zero and abs right-hand sides. 27 answers changed, each to { } or to the old answer without its non-roots, and all 27 were checked with mpmath. One equation, abs(2x+1)^(3/4) = abs(x) - 2, timed out at 20 s on both builds under load, so the sweep tells us nothing about it.
  • Harnesses. RootCheck gives 596/596 clean before and after. CasBench gives 120/121 before and after, 0 wrong, with identical verdicts.
  • Second sweep, at 1d109d00b against master 9b75a2678. 976 generated equations: abs(p/q) = c with linear and quadratic p, q and c in {1, 2, 1/2, sqrt(2)} (360), abs(a x + b) = c, sqrt(abs(a x + b)) = ±c, and abs(a x + b)^k = c for k in {2, 3, 1/2, 3/2, -1}. 112 answers changed, every one a family of sqrt(abs(u)) = -c or abs(u)^(1/2 or 3/2) = -c becoming { }; mpmath at 50 digits finds no member satisfying the equation at five angles for any of them. No abs(p/q) = c answer changed. No timeouts or exceptions on either build.
  • Unit suite. 22338 passed, 0 failed, 13 skipped.

Entry added to BREAKING-CHANGES.md.

Fixes #2712

🤖 Generated with Claude Code

sqrt(abs(x)) = -1 is raised to abs(x) = 1, whose roots e^(i r) were
answered: a family with a real parameter was never checked against the
equation, so the roots the raising added stayed. A root of a modulus is
real and not negative, and no member of the circle is a root.

Where every x in the equation is inside one modulus |u|, the equation is
a function of |u|, and |u| is the same at every member of the family the
modulus is inverted into (u = c e^(i r)). So one member decides the
family, as one member already decides a family over the integers. The
real angle parameter is put at 0 only under that condition.

Measured over 90 generated equations of roots of moduli: 27 answers
change, each to { } or to the old answer without its non-roots, checked
with mpmath. RootCheck and CasBench verdicts unchanged.

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

codecov Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.71%. Comparing base (409d688) to head (1d109d0).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...ontinuous/Solvers/EquationSolver/SolveStatement.cs 96.29% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2727      +/-   ##
==========================================
+ Coverage   86.65%   86.71%   +0.05%     
==========================================
  Files         346      346              
  Lines       76959    77113     +154     
  Branches    22644    22699      +55     
==========================================
+ Hits        66692    66866     +174     
+ Misses       5534     5529       -5     
+ Partials     4733     4718      -15     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.20% <96.77%> (+0.05%) ⬆️
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/SolutionParameters.cs 85.71% <100.00%> (+3.74%) ⬆️
...ontinuous/Solvers/EquationSolver/SolveStatement.cs 85.20% <96.29%> (+0.76%) ⬆️

... and 17 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 and others added 2 commits December 6, 2026 10:03
abs((x + 1) / (x - 1)) = 1 is answered -(e^(i r) + 1) / (1 - e^(i r)), the
imaginary axis, which at r = 0 is -2 / 0. A member with no value, or one its
own condition excludes, is no evidence against the family, so the next of a
few angles is tried, and a family with no member that has a value is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inverse of what is inside the modulus can be one branch of many:
abs(arctan(x)) = 2 is answered tan(2 e^(i r)), whose member tan(2) at r = 0
fails, as arctan(tan(2)) = 2 - pi, while i tanh(2) at r = pi/2 is a root.
The family is now judged at 0, pi/2, pi, -pi/2, pi/4, 3 pi/4, 1 and 2, kept
where a member with a value is a root, and dropped only where none is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet changed the title Judge a circle of roots of a modulus by one member Drop a circle of roots of a modulus only when none of its members is a root Dec 6, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit 578680e into master Dec 6, 2026
36 of 38 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Dec 6, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the fix-2712-sqrt-abs-negative branch December 6, 2026 13:36
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.

sqrt(abs(x)) = -1 is solved by squaring and gives e^(i r_1) instead of { }

1 participant