Repository navigation
Solve a conjunction of equations for several variables: MathS.SolveSystem - #2459
Merged
Merged
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
x + y = 3 and x - y = 1[[2, 1]]x^2 + y^2 = 25 and x - y = 1[[-3, -4], [4, 3]]x + y + z = 6 and (x - y = 0 and z = 2)x = y = 1x + y = 3 and x - y = 1[[2, 1, t_1]]x + y = 1 and x + y = 2Equationsanswers itx > 0,x in RR, anor, anot,trueEvery 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 theAndfis passed through as one equation. Reading conjunctions insideEquationSystemwould 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, fromreturn [system];lowering throughCollectionsMarshal; 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