private double GetCoefficient() { return(CoefficientsLine .Skip(myCoefSublineStart) .OrderBy(_ => Math.Abs(_.Value)) .Sum(_ => _.Value)); }
internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { var bracketYieldsConstants = CoefficientsLine .Skip(bracket.CoefficientOrder) .All(_ => _.Type == CoefficientType.Constant); return(bracketYieldsConstants ? new CoefficientYieldedFromBracketState(VariableAggregator, BracketsLine, CoefficientsLine, bracket.CoefficientOrder) : (EquationParserState) new AwaitSummandState(VariableAggregator, BracketsLine, CoefficientsLine)); }
internal override EquationParserState HandleClosingBracketOverride(Bracket bracket, int charIndex) { // fixing variable coefficient, because it is not added yet myCoefficient *= bracket.BracketMultiplier; AddVariable(); var bracketYieldsConstants = CoefficientsLine .Skip(bracket.CoefficientOrder) .All(_ => _.Type == CoefficientType.Constant); return(bracketYieldsConstants ? (EquationParserState) new CoefficientYieldedFromBracketState(VariableAggregator, BracketsLine, CoefficientsLine, bracket.CoefficientOrder) : new AwaitSummandState(VariableAggregator, BracketsLine, CoefficientsLine)); }