Beispiel #1
0
        public static void CLOSecn2Pt7Exerc2a()
        {
            Monomial.orderingScheme = "lex";
            Polynomial      p1 = new Polynomial(new double[] { 1, -1 }, new Monomial(2, 1), new Monomial(0, 0));
            Polynomial      p2 = new Polynomial(new double[] { 1, -1 }, new Monomial(1, 2), new Monomial(1, 0));
            PolynomialBasis gb = PolynomialBasis.GetGroebnerBasis(p1, p2);

            PrintPolynomialBasis(gb);
        }
Beispiel #2
0
        public static void CLOSec2Pt7Exerc9()
        {
            Monomial.orderingScheme = "lex";
            Polynomial p1 = new Polynomial(new double[] { 3, -6, -2 }, new Monomial(1, 0, 0, 0), new Monomial(0, 1, 0, 0), new Monomial(0, 0, 1, 0));
            Polynomial p2 = new Polynomial(new double[] { 2, -4, 4 }, new Monomial(1, 0, 0, 0), new Monomial(0, 1, 0, 0), new Monomial(0, 0, 0, 1));
            Polynomial p3 = new Polynomial(new double[] { 1, -2, -1, -1 }, new Monomial(1, 0, 0, 0), new Monomial(0, 1, 0, 0), new Monomial(0, 0, 1, 0), new Monomial(0, 0, 0, 1));

            PolynomialBasis gb = PolynomialBasis.GetGroebnerBasis(p1, p2, p3);

            PrintPolynomialBasis(gb);
        }
Beispiel #3
0
        public static void CLOSectn2Pt8Exerc11()
        {
            Monomial.orderingScheme = "lex";
            Polynomial      p1 = new Polynomial(new double[] { 1, 1, 1, -3 }, new Monomial(1, 0, 0), new Monomial(0, 1, 0), new Monomial(0, 0, 1), new Monomial(0, 0, 0));
            Polynomial      p2 = new Polynomial(new double[] { 1, 1, 1, -5 }, new Monomial(2, 0, 0), new Monomial(0, 2, 0), new Monomial(0, 0, 2), new Monomial(0, 0, 0));
            Polynomial      p3 = new Polynomial(new double[] { 1, 1, 1, -7 }, new Monomial(3, 0, 0), new Monomial(0, 3, 0), new Monomial(0, 0, 3), new Monomial(0, 0, 0));
            Polynomial      p4 = new Polynomial(new double[] { 1, 1, 1, -9 }, new Monomial(4, 0, 0), new Monomial(0, 4, 0), new Monomial(0, 0, 4), new Monomial(0, 0, 0));
            PolynomialBasis gb = PolynomialBasis.GetGroebnerBasis(p1, p2, p3, p4);

            PrintPolynomialBasis(gb);
        }
Beispiel #4
0
        public static void TestGroebnerBasisCLOSec2Pt7Exerc3()
        {
            Monomial.orderingScheme = "lex";
            Polynomial f = new Polynomial(new Monomial(new int[] { 2, 1 }));

            f.AddMonomial(new Monomial(new int[] { 0, 0 }), -1);

            Polynomial g = new Polynomial(new Monomial(new int[] { 1, 2 }));

            g.AddMonomial(new Monomial(new int[] { 1, 0 }), -1);

            PolynomialBasis gb = PolynomialBasis.GetGroebnerBasis(f, g);

            PrintPolynomialBasis(gb);
        }
Beispiel #5
0
        public static void TestGroebnerBasisCLOSecn2Pt7Example1()
        {
            Monomial.orderingScheme = "grlex";
            Polynomial f = new Polynomial(new Monomial(new int[] { 3, 0 })); // x^3

            f.AddMonomial(new Monomial(new int[] { 1, 1 }), -2.0);           // -2xy

            Polynomial g = new Polynomial(new Monomial(new int[] { 2, 1 })); // x^2y

            g.AddMonomial(new Monomial(new int[] { 0, 2 }), -2.0);           // -2y^2
            g.AddMonomial(new Monomial(new int[] { 1, 0 }));                 // x

            PolynomialBasis gb = PolynomialBasis.GetGroebnerBasis(f, g);

            PrintPolynomialBasis(gb);
        }
Beispiel #6
0
        public static void TestGroebnerBasisLinearSystem()
        {
            Monomial.orderingScheme = "lex";
            Polynomial f = new Polynomial(new Monomial(new int[] { 1, 0 }));

            f.AddMonomial(new Monomial(new int[] { 0, 1 }), 2);
            f.AddMonomial(new Monomial(new int[] { 0, 0 }), -3);

            Polynomial g = new Polynomial(new Monomial(new int[] { 1, 0 }));

            g.AddMonomial(new Monomial(new int[] { 0, 1 }), -2);
            g.AddMonomial(new Monomial(new int[] { 0, 0 }), -7);

            PolynomialBasis gb = PolynomialBasis.GetGroebnerBasis(f, g);

            PrintPolynomialBasis(gb);
        }
Beispiel #7
0
        /// <summary>
        /// Test method for Groebner basis.
        /// </summary>
        public static void TestGroebnerBasis()
        {
            Monomial.orderingScheme = "lex";

            //1st order
            var del_x = 1.0;
            var del_y = 2.0;

            //2nd order
            var del_x_x = 3.5;
            var del_x_y = 1.5;
            var del_y_y = 2.7;

            //3rd order
            var del_y_y_y = 1.1;
            var del_x_y_y = 1.9;
            var del_x_x_y = 2.3;
            var del_x_x_x = 1.4;

            Polynomial f = new Polynomial(new Monomial(new int[] { 2, 0 }), del_x_x_x);

            f.AddMonomial(new Monomial(new int[] { 1, 1 }), 2 * del_x_x_y);
            f.AddMonomial(new Monomial(new int[] { 0, 2 }), del_x_y_y);
            f.AddMonomial(new Monomial(new int[] { 1, 0 }), del_x_y);
            f.AddMonomial(new Monomial(new int[] { 0, 1 }), del_y_y);
            f.AddMonomial(new Monomial(new int[] { 0, 0 }), -del_x);

            Polynomial g = new Polynomial(new Monomial(new int[] { 2, 0 }), del_x_x_y);

            g.AddMonomial(new Monomial(new int[] { 1, 1 }), 2 * del_x_y_y);
            g.AddMonomial(new Monomial(new int[] { 0, 2 }), del_y_y_y);
            g.AddMonomial(new Monomial(new int[] { 1, 0 }), del_x_x);
            g.AddMonomial(new Monomial(new int[] { 0, 1 }), del_x_y);
            g.AddMonomial(new Monomial(new int[] { 0, 0 }), -del_y);

            PolynomialBasis gb = PolynomialBasis.GetGroebnerBasis(f, g);

            PrintPolynomialBasis(gb);
        }