Skip to content

A cube shifted is solved - #2315

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
a-shifted-cube-is-solved
Nov 1, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
a-shifted-cube-is-solved

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

SolveCubic takes Cardano's C as a cube root of (D1 + sqrt(D1^2 - 4 D0^3)) / 2. Either root of C^6 - D1 C^3 + D0^3 = 0 will do, as long as it isn't 0, since the roots divide by C. A shifted cube, a(x + h)^3 = k written out, has D0 = b^2 - 3ac = 0. The square root is then |D1|, so for a negative D1 the sum is 0 and C was 0. Every root was taken for -b/(3a), the triple-root branch, none of them was a root, and the empty set that was left claimed there was none.

Solve("x") 2.6.0 and master now
(x + 1)^3 = 2 { } { -(3 + -3 * 2 ^ (1/3)) / 3, … }, the three cube roots of 2 less 1
x^3 - 3x^2 + 3x - 3 = 0 { } 1 plus the three cube roots of 2
3x^3 + 9x^2 + 9x + 1 = 0 { } -1 plus the three cube roots of 2/3
x^3 + 3x^2 + 3x + 3 = 0 the three roots unchanged: D1 is positive
  • With D0 = 0, C is a cube root of D1 itself, and the roots are -(b + u C)/(3a), since D0/C is 0. For a negative D1 it's written as -(-D1)^(1/3), which is a cube root of D1 whichever root of a negative number a power is read as.
  • Found by a cross-check of equations in logarithms. One of them exponentiates to 3x^3 + 9x^2 + 9x + 1. No issue was filed.
  • Four of the new cases fail on master. The suite, the trio, F#, AOT and the eight harnesses pass. BREAKING-CHANGES.md has an entry.

🤖 Generated with Claude Code

SolveCubic takes Cardano's C as a cube root of (D1 + sqrt(D1^2 - 4 D0^3)) / 2, either root
of C^6 - D1 C^3 + D0^3 = 0 doing as long as it is not 0, since the roots divide by C. A
cube shifted, a(x + h)^3 = k written out, has D0 = b^2 - 3ac = 0, and then the square root
is |D1|, so for a negative D1 the sum is 0 and C was 0. Every root was taken for -b/(3a),
the branch for a triple root, none of them was a root, and the empty set that was left
claimed there was none: (x + 1)^3 = 2 and 3x^3 + 9x^2 + 9x + 1 = 0 were answered { }.

With D0 = 0, C is a cube root of D1 itself, and the roots are -(b + u C)/(3a), D0/C being
0. For a negative D1 it is written as the negative of the cube root of -D1, a cube root of
D1 whichever root of a negative number a power is read as.

Found by a cross-check of equations in logarithms, one of which exponentiates to
3x^3 + 9x^2 + 9x + 1. 2.6.0 answers them the same.

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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.75%. Comparing base (806f5f6) to head (c193858).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2315      +/-   ##
==========================================
- Coverage   86.77%   86.75%   -0.02%     
==========================================
  Files         311      311              
  Lines       68199    68221      +22     
  Branches    19823    19828       +5     
==========================================
+ Hits        59177    59187      +10     
- Misses       4880     4892      +12     
  Partials     4142     4142              
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.30% <100.00%> (-0.02%) ⬇️
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 Δ
...tinuous/Solvers/EquationSolver/PolynomialSolver.cs 85.37% <100.00%> (+0.69%) ⬆️

... 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 9880e18 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-shifted-cube-is-solved branch November 1, 2026 17:36
Rafael-SOWNet added a commit that referenced this pull request Nov 1, 2026
An equation in two or more logarithms of x had no route of its own, and came to Newton's
method, which answered it in decimals and left out the roots it did not reach:
ln(x) + ln(x + 1) = 0 was { 0.618... } and ln(1 + 3x^2) - ln(4x) = 1 was { 3.53 }, without
0.0944.

k_1 log_b(P_1) + ... + k_n log_b(P_n) = c, for polynomials P_i, rational k_i and one base,
holds only where P_1^(k_1 L) ... P_n^(k_n L) = b^(c L), L being the common denominator of
the k_i: a polynomial equation, whose roots are found exactly. Each is put back into the
equation as written under the principal logarithm and kept only where it holds, since over
the complex numbers ln(u) + ln(v) is ln(u v) only up to 2 pi i: at (-1 - sqrt(5))/2 both
logarithms of ln(x) + ln(x + 1) carry i pi, and the sum is 2 pi i. Over the reals each
argument is to be positive as well. A residual too small to tell from rounding, or a candidate that is not a root of the
polynomial, leaves the equation to the routes after, since the roots the polynomial solver
missed would be left out: 3x^3 + 9x^2 + 9x + 1, a shifted cube, comes back as -1 three
times until #2315.

On 400 random equations of this kind, checked against a Newton search under the principal
logarithm, master answers 292, leaves 108 unsolved and misses 25 roots in 22 of its
answers; this answers all 400, none unsound and none missing a root.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Rafael-SOWNet added a commit that referenced this pull request Nov 1, 2026
Every root a solver finds is put back into the equation as written, and the ones that fail
are dropped. Where all of them failed, the empty set was left, and the empty set claims
there is no root. For a polynomial of degree one or more, read over the complex numbers,
that is never true, so what failed was the solver: (x + 1)^3 = 2 came back { } while
Cardano's C was 0 for a shifted cube (#2315), and 31x^4 - 62x^3 + 33x^2 - 2x - 1 = 0 while a
biquadratic quartic was shifted by -b a / 4 (#2314). Such a polynomial is now left as the
set of the x that satisfy it, which claims only that its roots were not found.

Only a polynomial with numbers for coefficients and over the complex numbers: an equation
that is not a polynomial can have no root, as sqrt(x) = -1 has none, and so can a
polynomial over the reals.

With those two fixed, no equation known reaches this, so nothing answered changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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