diff --git a/Sources/AngouriMath/AngouriMath/Functions/Continuous/Solvers/EquationSolver.cs b/Sources/AngouriMath/AngouriMath/Functions/Continuous/Solvers/EquationSolver.cs index a1cc1d053..230a2bbde 100644 --- a/Sources/AngouriMath/AngouriMath/Functions/Continuous/Solvers/EquationSolver.cs +++ b/Sources/AngouriMath/AngouriMath/Functions/Continuous/Solvers/EquationSolver.cs @@ -77,7 +77,7 @@ internal static List> InSolveSystem(List equations, ReadOnl { var var = vars[^1]; if (equations.Count == 1) - return equations[0].InnerSimplified.SolveEquation(var) is FiniteSet els + return equations[0].InnerSimplified.SolveEquation(var).InnerSimplified is FiniteSet els ? els.Select(sol => new List { sol }).ToList() : new(); var result = new List>(); diff --git a/Sources/Tests/UnitTests/Algebra/SolveTest/SolveSystem.cs b/Sources/Tests/UnitTests/Algebra/SolveTest/SolveSystem.cs index cee23809f..29c806654 100644 --- a/Sources/Tests/UnitTests/Algebra/SolveTest/SolveSystem.cs +++ b/Sources/Tests/UnitTests/Algebra/SolveTest/SolveSystem.cs @@ -102,5 +102,24 @@ public void EquationWithDivisionIsSolved() => AssertSystemSolvable(new Entity[] "x2 + y", "y - x - 3" }, new Entity.Variable[] { "x", "y" }, 2); + + + [Fact] + public void SystemWithZero() => AssertSystemSolvable(new Entity[] { + "x - y - 1000", + "y - 0" + }, new Entity.Variable[] { "x", "y" }, 1); + + [Fact] + public void SystemWithZero2() => AssertSystemSolvable(new Entity[] { + "y - 0", + "x - y - 1000" + }, new Entity.Variable[] { "x", "y" }, 1); + + [Fact] + public void SystemWithZero3() => AssertSystemSolvable(new Entity[] { + "y - 0", + "x - y" + }, new Entity.Variable[] { "x", "y" }, 1); } }