Beispiel #1
0
 /// <summary>
 /// Returns polynom in n degree, actualy p^n
 /// </summary>
 /// <param name="p"></param>
 /// <param name="degree"></param>
 /// <returns></returns>
 public Polynom Degree(Polynom p, int n)
 {
     // TODO
     throw new NotImplementedException();
 }
Beispiel #2
0
 /// <summary>
 /// Returns polynom in n degree, actualy p^n
 /// </summary>
 /// <param name="p"></param>
 /// <param name="degree"></param>
 /// <returns></returns>
 public Polynom Degree(Polynom p, int n)
 {
     // TODO
     throw new NotImplementedException();
 }
Beispiel #3
0
        public void Level3_PolynomDegree()
        {
            var a1 = new Polynom() { coefficients = new double[] { 5, 8 } };

            var a3 = m.Degree(a1, 3);
            Assert.IsTrue(
                a3.coefficients[0] == 125 &&
                a3.coefficients[1] == 600 &&
                a3.coefficients[2] == 960 &&
                a3.coefficients[3] == 512);
        }
Beispiel #4
0
        public void Level3_PolynomMultiplying()
        {
            var a1 = new Polynom() { coefficients = new double[] { 5, -2, 8 } };
            var a2 = new Polynom() { coefficients = new double[] { -2, 1, -2 } };

            var a3 = a1 * a2;
            Assert.IsTrue(
                a3.coefficients[0] == 10 &&
                a3.coefficients[1] == 9 &&
                a3.coefficients[2] == -28 &&
                a3.coefficients[3] == 12 &&
                a3.coefficients[4] == -16);
        }
Beispiel #5
0
        public void Level3_PolynomDifference()
        {
            var a1 = new Polynom() { coefficients = new double[] { 1, 2, 3, 4, 5 } };
            var a2 = new Polynom() { coefficients = new double[] { 4, 3, 1, 5, 8 } };

            var a3 = a1 - a2;
            Assert.IsTrue(
                a3.coefficients[0] == -3 &&
                a3.coefficients[1] == -1 &&
                a3.coefficients[2] == 2 &&
                a3.coefficients[3] == -1 &&
                a3.coefficients[4] == -3);
        }
Beispiel #6
0
        public void Level3_PolynomSumma()
        {
            var a1 = new Polynom() { coefficients = new double[] { 1, 2, 3, 4, 5 } };
            var a2 = new Polynom() { coefficients = new double[] { 4, 3, 1, 5, 8 } };

            var a3 = a1 + a2;
            Assert.IsTrue(
                a3.coefficients[0] == 5 &&
                a3.coefficients[1] == 5 &&
                a3.coefficients[2] == 4 &&
                a3.coefficients[3] == 9 &&
                a3.coefficients[4] == 13);
        }