public void Constructor_Polynomial() { Polynomial constant = 1; PolynomialDivision v = _x / constant; v.IsPolynomial.AssertIsTrue(); v.IsConstant.AssertIsFalse(); v.ToString().AssertIsEqualTo("x"); }
public void Constructor_Default() { PolynomialDivision v = default; v.AssertIsEqualTo(0); (v == 0).AssertIsTrue(); v.IsPolynomial.AssertIsTrue(); v.IsConstant.AssertIsTrue(); v.ToString().AssertIsEqualTo("0"); v.DerivativeBy('a').AssertIsEqualTo(0); (2 * v).AssertIsEqualTo(0); (v / 2).AssertIsEqualTo(0); v.GetOperation().Value().AssertIsEqualTo(0); }
public void Constructor_Variable() { PolynomialDivision v = 'a'; (v == 0).AssertIsFalse(); v.IsConstant.AssertIsFalse(); v.IsPolynomial.AssertIsTrue(); v.ToString().AssertIsEqualTo("a"); ((PolynomialTerm)v).AssertIsEqualTo('a'); v.DerivativeBy('a').AssertIsEqualTo(1); v.DerivativeBy('b').AssertIsEqualTo(0); (2 * v).AssertIsEqualTo(2 * Term.a); (v / 2).AssertIsEqualTo(0.5 * Term.a); v.GetOperation('a').Value(5).AssertIsEqualTo(5); }
public void Constructor_Constant() { PolynomialDivision v = 2; (v == 0).AssertIsFalse(); v.IsPolynomial.AssertIsTrue(); v.IsConstant.AssertIsTrue(); v.ToString().AssertIsEqualTo("2"); v.AssertIsEqualTo(2); (1 == v).AssertIsFalse(); (0 == v).AssertIsFalse(); v.DerivativeBy('a').AssertIsEqualTo(0); (2 * v).AssertIsEqualTo(4); (v / 2).AssertIsEqualTo(1); v.GetOperation().Value().AssertIsEqualTo(2); }