Skip to content

A system's answer with each parameter and its set; independent periods get their own parameters - #2473

Open
Rafael-SOWNet wants to merge 1 commit into
masterfrom
feature/system-parameters
Open

Rafael-SOWNet wants to merge 1 commit into
masterfrom
feature/system-parameters

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Option 1 from #212, as decided: a system's answer together with each parameter and the set it ranges over.

public ParametrizedSolutions? EquationSystem.SolveWithParameters(params Variable[] vars)
public static ParametrizedSolutions? MathS.SolveSystemWithParameters(Entity system, params Variable[] variables)
public sealed record ParametrizedSolutions(Matrix Rows, IReadOnlyList<(Variable Parameter, Set Domain)> Parameters)

2x - 4y - 12 in x, y is the rows [[6 + 2 t_1, t_1]] with (t_1, CC); sin(x) - 1/2 in x, y lists (n_1, ZZ) and (t_1, CC). Parameters are in order of first appearance, the list is empty when there are none, and the call is null where Solve is null, or where a parameter's set cannot be named (a decline, not a guess). Solve is unchanged apart from the fix below.

Every site that mints a parameter now goes through SolutionParameters.Mint(taken, prefix, set), which records the set:

parameter minted in set
n periods of sin, cos, tan, cotan; mod; Lambert W branches ZZ
r inverting abs RR
r inverting signum (0, +oo)
t inverting floor, ceil [0, 1)
t inverting round (-1/2, 1/2)
t a free unknown CC, or RR under a real codomain

NonSquareSystemSolver used to decide which symbols are whole numbers by the n_ prefix; it now reads the recorded set.

A wrong answer fixed on the way

Two independent parameters in one row were given the same name, which made the answer incomplete:

system was (2.7.0, and master) now
sin(x) - 1/2, sin(y) - 1/2 in x, y four rows like [pi/6 + 2 pi n_1, pi/6 + 2 pi n_1]: x − y a whole number of periods, so (pi/6, 13 pi/6) is missing each unknown its own n_1, n_2

The same collision happened with sin and cos, three tans, two floors (t_1) and two abs (r_1); all six are recorded in BREAKING-CHANGES.md, measured on v2.7.0 and the branch. Where a root is combined with the rows solved after it (InSolveSystem, and EachRoot in NonSquareSystemSolver), a parameter of the root is renamed if the rows below minted the same name themselves. A parameter that reaches a later equation stays shared, as it must: tan(x) - 1, y - x is still [pi/4 + pi n_1, pi/4 + pi n_1]. Names are global within an answer, which is documented. All 28 probe systems diffed against a v2.7.0 build: only the collisions changed.

Wiring: catalogue entries solve_system_with_parameters and solve_conjunction_with_parameters; MCP am_solve_system returns "parameters": [{"parameter": "n_1", "set": "ZZ"}, …]; the terminal lists both entries in OneShot.notOffered; PublicApi.txt; XML docs with examples.

SystemParametersTest: 15 facts, each substituting the rows back with two sample values per parameter from its set (whole numbers for ZZ, inner points of the intervals), and asserting the rows equal Solve's. Full check before the rebase onto c530e40: 20,134 unit tests, 0 failed; MCP 446, Terminal 69, F# 134, Interactive 19; AOT 78/78; BoundCheck 0 disagreements, RootCheck 596/596, CasBench 120/121 with 0 wrong, SimpSweep 10463/10463, RuleCheck clean, CanonCheck and Confluence at their baselines. After the rebase: system, solver, catalogue and API tests, 1,060 passed.

Closes #212.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.97%. Comparing base (73b77bf) to head (2745d2d).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...nuous/Solvers/EquationSolver/SolutionParameters.cs 83.33% 3 Missing and 3 partials ⚠️
Sources/AngouriMath/Core/EquationSystem.cs 80.95% 2 Missing and 2 partials ⚠️
...nuous/Solvers/EquationSolver/InvertNode.Classes.cs 83.33% 0 Missing and 2 partials ⚠️
...us/Solvers/EquationSolver/NonSquareSystemSolver.cs 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2473      +/-   ##
==========================================
- Coverage   86.97%   86.97%   -0.01%     
==========================================
  Files         324      325       +1     
  Lines       71849    71920      +71     
  Branches    20955    20977      +22     
==========================================
+ Hits        62492    62552      +60     
- Misses       5024     5028       +4     
- Partials     4333     4340       +7     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.50% <85.55%> (-0.01%) ⬇️
fsharp 32.97% <ø> (ø)
interactive 39.95% <100.00%> (+0.13%) ⬆️

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.80% <100.00%> (+0.02%) ⬆️
Sources/AngouriMath/Core/Operations/Catalogue.cs 100.00% <100.00%> (ø)
...ath/Functions/Continuous/Solvers/EquationSolver.cs 87.15% <100.00%> (+0.29%) ⬆️
...ontinuous/Solvers/EquationSolver/LambertWSolver.cs 88.88% <100.00%> (ø)
...nuous/Solvers/EquationSolver/LinearSystemSolver.cs 87.64% <100.00%> (ø)
...urces/Terminal/AngouriMath.Terminal.Lib/OneShot.fs 69.67% <100.00%> (+0.19%) ⬆️
...us/Solvers/EquationSolver/NonSquareSystemSolver.cs 87.25% <50.00%> (-0.99%) ⬇️
...nuous/Solvers/EquationSolver/InvertNode.Classes.cs 61.85% <83.33%> (ø)
Sources/AngouriMath/Core/EquationSystem.cs 84.48% <80.95%> (-2.01%) ⬇️
...nuous/Solvers/EquationSolver/SolutionParameters.cs 83.33% <83.33%> (ø)

... and 5 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

Copy link
Copy Markdown
Member Author

Rebased onto 73b77bf after #2470 (shader source) merged. The catalogue's list of entries and the terminal's notOffered had gained hlsl and glsl there; both now hold master's entries plus this PR's two, and nothing else (diffed). System, solver, catalogue, API and shader unit tests: 1,130 passed; MCP 446; Terminal 69.

@Rafael-SOWNet
Rafael-SOWNet force-pushed the feature/system-parameters branch from e572477 to 2745d2d Compare November 16, 2026 02:03
EquationSystem.SolveWithParameters(params Variable[]) and
MathS.SolveSystemWithParameters(Entity, params Variable[]) answer the rows
Solve answers and, beside them, each parameter of the rows with its set,
as ParametrizedSolutions(Matrix Rows, IReadOnlyList<(Variable Parameter,
Set Domain)> Parameters). sin(x) = 1/2 in x, y is the two rows with
(n_1, ZZ), (t_1, CC). An answer without parameters lists none; null where
Solve is null, and where a parameter's set cannot be named.

The set is said where the parameter is minted, by SolutionParameters.Mint:
ZZ for the n of a period, a mod and a Lambert W branch, RR for the
argument r of abs, (0, oo) for the r of signum, [0, 1) for the t of floor
and ceil, (-1/2, 1/2) for round, and CC (RR over the reals) for an unknown
nothing constrains. The non-square check reads which symbols are whole
from there rather than from an "n_" prefix.

A second equation's roots minted the same name as the first's where the
two do not reach each other, so sin(x) = 1/2, sin(y) = 1/2 was
(pi/6 + 2 pi n_1, pi/6 + 2 pi n_1) and left out (pi/6, 13 pi/6). Such a
parameter is renamed where the rows are put together (n_2), one that
reaches a later equation stays shared (tan(x) = 1, y = x), and while a
system is solved one name stands for one set. Measured on v2.7.0 and
here; the changed answers are in BREAKING-CHANGES.md.

solve_system_with_parameters and solve_conjunction_with_parameters join
the catalogue; am_solve_system reports 'parameters', each with its set;
the terminal lists both entries in OneShot.notOffered.

Part of #212.

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

Copy link
Copy Markdown
Member Author

Rebased onto 1a80be1 after #2475 (budget by role). One code conflict, in EquationSolver.SolveSystem: #2475 made the ledger BudgetLedger.For("SolveSystem", SystemSolveBudget, BudgetRole.Allowance), and this PR opens the parameter scope right after it; both are kept. The .editorconfig entries now sit near the top of the file instead of at its end, where every PR appends. System, solver, budget, catalogue and API tests: 1,092 passed; MCP 450.

@Rafael-SOWNet
Rafael-SOWNet force-pushed the feature/system-parameters branch from 2745d2d to 9efa0a2 Compare November 16, 2026 03:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Support parametric solutions

1 participant