public Vector<double> Solve(EquationsSystem system) { var simplifiedSystem = Simplify(system); var systemMatrix = simplifiedSystem.GetMatrix(); var freeTerms = simplifiedSystem.GetFreeTermsVector(); if (systemMatrix.IsSquare()) { if (systemMatrix.RowCount<3) { strategy = new CramersMethod(); } else { strategy = new MatrixMethod(); } } return strategy.Solve(systemMatrix,freeTerms); }
public Vector <double> Solve(EquationsSystem system) { var simplifiedSystem = Simplify(system); var systemMatrix = simplifiedSystem.GetMatrix(); var freeTerms = simplifiedSystem.GetFreeTermsVector(); if (systemMatrix.IsSquare()) { if (systemMatrix.RowCount < 3) { strategy = new CramersMethod(); } else { strategy = new MatrixMethod(); } } return(strategy.Solve(systemMatrix, freeTerms)); }
private EquationsSystem Simplify(EquationsSystem system) { var simplifiedEquations = system.Equations.Select(x => x.Simplify()); return new EquationsSystem(simplifiedEquations); }
private EquationsSystem Simplify(EquationsSystem system) { var simplifiedEquations = system.Equations.Select(x => x.Simplify()); return(new EquationsSystem(simplifiedEquations)); }