Skip to content

An odd root of a negative real is a preimage, as the evaluator takes it - #2313

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
an-odd-root-of-a-negative-real-is-a-preimage
Nov 1, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
an-odd-root-of-a-negative-real-is-a-preimage

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

#212 (#2183) leaves a root of x^p = v only where v is in the sector the principal power takes its values in, -p pi < arg <= p pi for 0 < p < 1. The evaluator doesn't take every power as principal, though. A negative real to a rational power whose denominator is odd and below ten is the real root to the numerator, as Number.Pow's search for a good root finds it, so (-8)^(1/3) is -2. The sector therefore dropped roots that 2.6.0 found and the evaluator confirms.

Solve("x") 2.6.0 master now
x^(1/3) = -2 { -8 } { } { -8 }
x^(1/5) = -2 { -32 } { } { -32 }
x^(-1/3) = -1/2 { -8 } { } { -8 }
x^(2/3) = 4 { 8 } { 8 } { 8, -8 }
x^(1/3) = a { a ^ 3 } … provided a = 0 or -1/3 * pi < arg(a) and arg(a) <= 1/3 * pi the same or arg(a) = pi
  • Odd numerator: the negative reals are values too, so the condition gains arg(v) = pi, and a value known to be real needs no condition, or only v ≠ 0 for a negative power.
  • Even numerator: a negative base has a positive power, (-8)^(2/3) = 4, so a positive value also has the negative of its principal preimage. (-8)^(4/3) = 16 likewise.
  • A denominator of ten or more, or an even one, is the principal power, as it is in the evaluator: x^(1/11) = -1 and sqrt(x) = -2 stay { }.
  • One existing row pinned the regression: x^(1/3) = a with no root at a = -1. It now holds there, since (-1)^3 = -1 and (-1)^(1/3) is -1. The BREAKING-CHANGES.md entry for Support parametric solutions #212 says so.
  • Found by a cross-check of 400 random equations in square and cube roots against a complex and a real Newton search, under the evaluator's convention. It also found the { } answers that A quartic that is biquadratic once depressed is solved #2314's quartic fix answers. Seven of the new cases fail on master. The suite, the trio, F#, AOT and the eight harnesses pass.

Follows #2183, for #212.

🤖 Generated with Claude Code

#212 states the sector the principal power z^p takes its values in, -p pi < arg <= p pi
for 0 < p < 1, and leaves a root of x^p = v only where v is in it. The evaluator does not
take every power as principal: a negative real to a rational power whose denominator is
odd and below ten is the real root to the numerator, as Number.Pow's search for a good
root finds it, so (-8)^(1/3) is -2. So x^(1/3) = -2, x^(1/5) = -2 and x^(-1/3) = -1/2,
which 2.6.0 answered { -8 }, { -32 } and { -8 }, were answered { }, the value being outside
the sector.

With an odd numerator the negative reals are values as well, and the condition gains
arg(v) = pi; a value known to be real is then always in range. With an even numerator a
negative base has a positive power, (-8)^(2/3) = 4, so a positive value has the negative of
its principal preimage as well: x^(2/3) = 4 is { 8, -8 }, where 2.6.0 had { 8 }. A
denominator of ten or more, or an even one, is the principal power, as the evaluator's is.

The test that pinned x^(1/3) = a as no root at a = -1 pinned this: (-1)^3 = -1, and
(-1)^(1/3) is -1.

Found by a cross-check of equations in square and cube roots against a Newton search.

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

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.76%. Comparing base (3fc4022) to head (d2c865c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...nuous/Solvers/EquationSolver/InvertNode.Classes.cs 90.90% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2313      +/-   ##
==========================================
- Coverage   86.76%   86.76%   -0.01%     
==========================================
  Files         311      311              
  Lines       68199    68216      +17     
  Branches    19821    19825       +4     
==========================================
+ Hits        59175    59187      +12     
- Misses       4881     4884       +3     
- Partials     4143     4145       +2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.31% <90.90%> (-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 Δ
...nuous/Solvers/EquationSolver/InvertNode.Classes.cs 62.13% <90.90%> (+2.13%) ⬆️

... and 1 file 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 5f7a0de 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 an-odd-root-of-a-negative-real-is-a-preimage branch November 1, 2026 16:20
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