public void FromPolynomial_0_1_0_0_Subtract_AnotherOne_1_10_2_Expected_Minus1_Minus9_Minus2()
 {
     var p = new Polynomial(0, 1, 0, 0);
     var p1 = new Polynomial(1, 10, 2);
     Polynomial res = p.Subtract(p1);
     Assert.AreEqual(res, new Polynomial(-1, -9, -2));
 }
 public void Polynomial_1_2_3_Minus_AnotherOne_0_10_Expected_1_Minus8_3()
 {
     var p = new Polynomial(1, 2, 3);
     var p1 = new Polynomial(0, 10);
     Polynomial res = p - p1;
     Assert.AreEqual(res, new Polynomial(1, -8, 3));
 }
 public void Polynomial_0_1_0_0_Add_AnotherOne_1_10_2_Expected_1_11_2()
 {
     var p = new Polynomial(0, 1, 0, 0);
     var p1 = new Polynomial(1, 10, 2);
     Polynomial res = p1.Add(p);
     Assert.AreEqual(res, new Polynomial(1, 11, 2));
 }
 public void Polynomial_1_2_3_Plus_AnotherOne_0_10_Expected_1_12_3()
 {
     var p = new Polynomial(1, 2, 3);
     var p1 = new Polynomial(0, 10);
     Polynomial res = p + p1;
     Assert.AreEqual(res, new Polynomial(1, 12, 3));
 }
Exemple #5
0
 //[Specialize]
 public static double TestLarge(double x)
 {
     double[] coef = new double[64];
     for(int i = 0; i < coef.Length; i++)
         coef[i] = i;
     Polynomial p = new Polynomial(coef);
     return p.Calc(x);
 }
Exemple #6
0
 public static double Test2(double a0, double a1, double a2, double x)
 {
     double[] coef = {a0,a1,a2};
     Polynomial p = new Polynomial(coef);
     return p.Calc(x);
 }
Exemple #7
0
 public static double Test(double x)
 {
     double[] coef = {1,2,3}; // p(x) = 1+2x+3x^2
     Polynomial p = new Polynomial(coef);
     return p.Calc(x);
 }
 public void TryToChangePolynom_ExpectedUnchangedValue()
 {
     var p = new Polynomial(5, 2, 0, 0);
     p.Coefficients[0] = 10;
     Assert.AreEqual(new Polynomial(5 ,2), p);
 }
 public void InitializePolynimialByNullArray_ExpectedException()
 {
     var p = new Polynomial(0, 0, 0);
 }
 public void PolynomialEquals()
 {
     var p = new Polynomial(5, 2, 0, 0);
     var p1 = new Polynomial(5, 2);
     Assert.AreEqual(p1.Equals(p), true);
 }
 public void CountValue_X_IsEquals5_Polynomial_5_2_Expected_15()
 {
     var p = new Polynomial(5, 2);
     double d = p.CountValue(5);
     Assert.AreEqual(d, 15);
 }
 public void Polynomial_0_1_10_0_MultiplyBy_5_Expected_0_5_50()
 {
     var p = new Polynomial(0, 1, 10, 0);
     Polynomial res = p*5;
     Assert.AreEqual(res, new Polynomial(0, 5, 50));
 }
 public void Number_5_MultiplyBy_Polynomial_0_1_10_0_Expected_0_5_50()
 {
     var p = new Polynomial(0, 1, 10, 0);
     Polynomial res = 5*p;
     Assert.AreEqual(res, new Polynomial(0, 5, 50));
 }
 public void InitializePolynomialByAnotherOne()
 {
     var p = new Polynomial(0, 1, 2, 3);
     var p1 = new Polynomial(p);
     Assert.AreEqual(p1, p);
 }
 public void CreationPolynomialCoeffs_0_1_2_3()
 {
     var p = new Polynomial(0,1,2,3,0,0);
     Assert.AreEqual(new Polynomial(0,1,2,3), p);
 }