public void FromRootsTest() { //arrange double TOL = 10E-10; Complex[] roots = new Complex[] { 3, 0, 158.3, 13, 8 }; //action CPolynomial poly = CPolynomial.FromRoots(roots); //assert for (int i = 0; i < roots.Length; i++) { Complex p = poly.Evaluate(roots[i]); Complex.Abs(p).Should().BeLessThan(TOL); } }
public override object Evaluate() { IList <Complex> roots = SubExpression.EvaluateAsComplexVector(); return(new CMatrix(CPolynomial.FromRoots(roots).ToArray())); }