JuanGdelaCruz / GrobnerBasis

Library for computing Gröbner Basis in .NET. Includes sample application that checks if a given graph is k-colorable using the API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

General description

Library for computing Gröbner Basis in .NET using Buchberger´s algorithm. Includes sample application that checks if a given graph is k-colorable using the API. Developed for my bachelor´s project (see http://oa.upm.es/63155/ ).

Usage example

Given a polynomial ring in R with two variables, named x and y, that is R[x,y].

            Ring r = new Ring(Field.Real, new string[] { "x", "y" });

Fixing y>x with the lexicographical order.

            r.FixOrder(new string[] { "y", "x" });
            r.Order= MonomialOrder.lex;

And given the following polynomials in the ring:

  • f1: xy -x
            Polynomial f1 = new Polynomial(r);
            f1.AddTerm(1, new int[] { 1, 1 });
            f1.AddTerm(-1, new int[] { 1, 0 });
  • f2: -y +x^2
            Polynomial f2 = new Polynomial(r);
            f2.AddTerm(-1, new int[] { 0, 1 });
            f2.AddTerm(1, new int[] { 2, 0 });

The ideal generated by f1 and f2 is:

            Ideal I = new Ideal(new Polynomial[] { f1, f2 }, r);

Which has as minimal Gröbner basis:

            var minimal = I.MinimalGröbnerBasis();

Being the reduced Gröbner basis:

            var reduced = I.ReducedGrobnerBasis(); 
            

We can also verify if a polynomial belongs to the ideal:

            I.Member(f1);

About

Library for computing Gröbner Basis in .NET. Includes sample application that checks if a given graph is k-colorable using the API.

License:MIT License


Languages

Language:C# 100.0%