Skip to content

Write a solved root with one sign where it had two - #2573

Merged
Rafael-SOWNet merged 3 commits into
masterfrom
a-solved-linear-root-without-two-signs
Nov 27, 2026
Merged

Rafael-SOWNet merged 3 commits into
masterfrom
a-solved-linear-root-without-two-signs

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Fixes #2566.

The root of an equation linear in the unknown was written -b / a. Inverting a product divided the other side by the factor as it stood. Where the coefficient was written with a minus sign, the root then carried two signs, as in -p * V / (-n * R). Most roots of formulas solved for one of their letters come through the second of these, the inversion of a product. p V - n R T is read as -n R * T + p V, so T is -p V over -n R.

A minus sign in front of the divisor is now taken off it and off the dividend, in the polynomial solver (SolveLinear, and x^n = -b/a) and in Mulf.InvertNode. A divisor counts as written with one when it is:

  • a negative number;
  • a product whose numbers multiply to a negative one (a coefficient read off a polynomial arrives as 1 * (-1) * n * R);
  • a quotient with such a dividend;
  • a sum each of whose terms is one.

Only the printed form changes; b / (-a) and -b / a are the same value everywhere.

.Solve(...) and .SolveEquation(...) of 2.9.0 this branch
p V = n R T for T { -p * V / (-n * R) } { p * V / (n * R) }
b = a x for x { -b / (-a) } { b / a }
c - 2 x = 0 for x { -c / (-2) } { c / 2 }
3 - 4 y x = 0 for x { (-3) / ((-4) * y) } { 3 / (4 * y) }
1/R = 1/a + 1/b for R { (-1) / (-1 / a + -1 / b) } { 1 / (1 / a + 1 / b) }
E = m v^2 / 2 for v { sqrt(-E / (-m * 1/2)), ... } { sqrt(E / (m * 1/2)), ... }
T = 2 pi sqrt(L / g) for L { (-T / ((-2) * pi)) ^ 2 * g provided ... } { (T / (2 * pi)) ^ 2 * g provided ... }

The issue's last row, -g * 2 * 1/4 + -g * 2 * 1/4, is a sum InnerSimplified does not collect, and is not touched here.

The Modenov corpus gains one row. III.P26.8, q - (1 + p^(-3)) z = z, was solved and verified, but was not reduced to the expected q / (2 + p^(-3)) while it carried two signs. The baseline records it as Solved: 481 solved, 0 wrong.

Local checks:

  • the suite: 21,529 passed;
  • the MCP, Terminal, Interactive and F# suites;
  • AOT: 83 passed, and the smoke test published with AngouriMathPublishAot=true;
  • all nine harnesses, with canoncheck and confluence matching their baselines and the Modenov corpus changing as above;
  • the solver cross-checks and scalecheck: identical to master except timings.

🤖 Generated with Claude Code

Rafael-SOWNet and others added 3 commits November 26, 2026 23:43
The root of an equation linear in the unknown was written -b / a, and
inverting a product divided the other side by the factor as it stood, so a
coefficient written with a minus sign left the root with two: p V = n R T
solved for T was { -p * V / (-n * R) }, c - 2 x = 0 was { -c / (-2) }, and
1/R = 1/a + 1/b was { (-1) / (-1 / a + -1 / b) }.

A minus sign in front of the divisor is now taken off it and off the dividend,
in the polynomial solver and in the inversion of a product. A divisor counts
as written with one when it is a negative number, a product whose numbers
multiply to a negative one (a coefficient read off a polynomial arrives as
1 * (-1) * n * R), a quotient with such a dividend, or a sum each of whose
terms is one. Only the printed form changes; the values are the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
q - (1 + p^(-3)) z = z was solved and its root verified, but written with two
signs it was not reduced to the expected q / (2 + p^(-3)); with one sign it
is. 481 solved, 0 wrong.

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

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.73%. Comparing base (4faf113) to head (5e28282).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...tinuous/Solvers/EquationSolver/PolynomialSolver.cs 86.20% 1 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2573      +/-   ##
==========================================
+ Coverage   86.71%   86.73%   +0.01%     
==========================================
  Files         344      344              
  Lines       74833    74884      +51     
  Branches    21838    21856      +18     
==========================================
+ Hits        64894    64949      +55     
+ Misses       5372     5363       -9     
- Partials     4567     4572       +5     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.23% <87.09%> (+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 60.30% <100.00%> (ø)
...tinuous/Solvers/EquationSolver/PolynomialSolver.cs 86.42% <86.20%> (-0.14%) ⬇️

... 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 213af16 into master Nov 27, 2026
35 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 27, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the a-solved-linear-root-without-two-signs branch November 27, 2026 01:05
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.

A solved linear root carries its sign twice: p V = n R T gives -p * V / (-n * R)

1 participant