/// <summary> /// Evaluate a polynomial at an input point. /// Uses Horner's method, first discovered by Persian mathematician /// Sharaf al-Dīn al-Ṭūsī, which evaluates a polynomial by minimizing /// the number of multiplications. /// </summary> /// <param name="x"></param> /// <returns></returns> public int EvaluateAt(int x) { var sum = 0; foreach (var c in Coefficients.AsEnumerable().Reverse()) { sum = sum * x + c; } return(sum); }