コード例 #1
0
 public IEnumerable<IterativeResult> SolveSystems(
     IEnumerable<ISystemEquations> systemEquations,
     IterativeMethod iterativeMethod,
     double eps = 0.001)
 {
     return systemEquations.Select(systemEquation => SolveSystem(systemEquation, iterativeMethod, eps));
 }
コード例 #2
0
        public IterativeResult SolveSystem(ISystemEquations systemEquations, IterativeMethod method, double eps = 0.001)
        {
            switch (method)
            {
                case IterativeMethod.SimpleIterations:
                    // todo выполнить проверку на возможность приведения к типу
                    return
                        new SimpleIterationsMethod(systemEquations, eps).Solve();

                case IterativeMethod.Seidel:
                    return new SeidelMethod(systemEquations, eps).Solve();

                default:
                    return null;
            }
        }
コード例 #3
0
        public double Get(int iterations, string modelToUse)
        {
            IterativeMethod pi = null;

            switch (modelToUse)
            {
            case "Gregory-Leibniz":
                pi = new Gregory_Leibniz();
                break;

            case "Nilikantha":
                pi = new Nilikantha();
                break;

            default:
                throw new System.Exception($"Could not find [{modelToUse}] model.");
            }
            pi.NumberOfIterations = iterations;
            return(pi.Calculate());
        }