Skip to content

Solve a conjunction of equations for several variables: MathS.SolveSystem - #2459

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
feature/solve-a-conjunction
Nov 15, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
feature/solve-a-conjunction

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

MathS.SolveSystem(Entity system, params Variable[] variables) reads a
statement that is a conjunction of equations -- nested or not, a chain
a = b = c included, since it parses as a = b and b = c -- as a system,
each a = b as a - b = 0, and answers what MathS.Equations(...).Solve
answers for the conjuncts listed: a row per solution, a free variable a
parameter, null where no solution was found. x + y = 3 and x - y = 1 is
[[2, 1]].

A conjunct that is not an equation (an inequality, in, or, not, a
boolean, an equality of statements) is not dropped, since solving the
rest would answer a different question: the call is null. One equation
is a system of one, and an expression that is not a statement is read
as equal to zero, as SolveEquation reads one. An inconsistent system is
null, as the system solver answers it for the same equations listed.

Solve(Variable) on a conjunction and MathS.Equations on an Andf are
unchanged.

solve_conjunction joins the catalogue. am_solve_system takes the system
as 'statement', one string, besides 'equations', and names the conjunct
it declines; the terminal lists the entry in OneShot.notOffered.

statement variables answer
x + y = 3 and x - y = 1 x, y [[2, 1]]
x^2 + y^2 = 25 and x - y = 1 x, y [[-3, -4], [4, 3]]
x + y + z = 6 and (x - y = 0 and z = 2) x, y, z one row
x = y = 1 x, y one row
x + y = 3 and x - y = 1 x, y, z [[2, 1, t_1]]
x + y = 1 and x + y = 2 x, y null, as Equations answers it
a conjunct x > 0, x in RR, an or, a not, true x, y null

Every row is substituted back into every conjunct and simplifies to 0.

Not changed here, and worth a separate decision: MathS.Equations("x+y=3 and x-y=1").Solve(x, y) is null, since the Andf is passed through as one equation. Reading conjunctions inside EquationSystem would turn that null into [[2, 1]], which is a changed answer and would need its own entry.

Full check on the first commit: UnitTests had one failure, KernelDependenciesTest, from return [system]; lowering through CollectionsMarshal; fixed with a list initialiser, and UnitTests re-run: 19,985 passed, 0 failed. MCP 444, Terminal 69, F# 134, Interactive 19; AOT OK; BoundCheck 0 disagreements, RootCheck 596/596, CasBench 120/121 with 0 wrong, PropCheck 1355/0, SimpSweep 10463/10463, RuleCheck clean, CanonCheck and Confluence at their baselines.

Closes #2450.

🤖 Generated with Claude Code

…stem

MathS.SolveSystem(Entity system, params Variable[] variables) reads a
statement that is a conjunction of equations -- nested or not, a chain
a = b = c included, since it parses as a = b and b = c -- as a system,
each a = b as a - b = 0, and answers what MathS.Equations(...).Solve
answers for the conjuncts listed: a row per solution, a free variable a
parameter, null where no solution was found. x + y = 3 and x - y = 1 is
[[2, 1]].

A conjunct that is not an equation (an inequality, in, or, not, a
boolean, an equality of statements) is not dropped, since solving the
rest would answer a different question: the call is null. One equation
is a system of one, and an expression that is not a statement is read
as equal to zero, as SolveEquation reads one. An inconsistent system is
null, as the system solver answers it for the same equations listed.

Solve(Variable) on a conjunction and MathS.Equations on an Andf are
unchanged.

solve_conjunction joins the catalogue. am_solve_system takes the system
as 'statement', one string, besides 'equations', and names the conjunct
it declines; the terminal lists the entry in OneShot.notOffered.

Part of #2450.

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

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.97%. Comparing base (e5f544f) to head (b08230a).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2459      +/-   ##
==========================================
- Coverage   86.98%   86.97%   -0.02%     
==========================================
  Files         320      320              
  Lines       71174    71196      +22     
  Branches    20759    20764       +5     
==========================================
+ Hits        61914    61922       +8     
- Misses       4970     4983      +13     
- Partials     4290     4291       +1     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.50% <100.00%> (-0.02%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 39.81% <100.00%> (ø)

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

Files with missing lines Coverage Δ
Sources/AngouriMath/Convenience/MathS.cs 90.71% <100.00%> (+0.02%) ⬆️
Sources/AngouriMath/Core/EquationSystem.cs 85.29% <100.00%> (+14.70%) ⬆️
Sources/AngouriMath/Core/Operations/Catalogue.cs 100.00% <100.00%> (ø)
...urces/Terminal/AngouriMath.Terminal.Lib/OneShot.fs 69.48% <100.00%> (ø)

... 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 1b9d66f into master Nov 15, 2026
35 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the feature/solve-a-conjunction branch November 15, 2026 21:06
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Nov 15, 2026
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.

Solve a conjunction of equations for several variables

1 participant