Note: This is taken from the Chicken Wiki, where a more recent version could be available.

Introductory

This egg is for finding Gröbner Basis for a set of polynomials.

What is a Gröbner Basis? Visit:

http://www.geocities.com/CapeCanaveral/Hall/3131/

Limitation

You need to (define) specify the number of variables for the polynomial set.

Examples

CHICKEN

Version 2.732 - linux-unix-gnu-x86 [ symbolgc manyargs dload ptables applyhook cross ]

©2000-2007 Felix L. Winkelmann compiled 2007-11-09 on localhost (Linux)

1> (use numbers grobner-basis)

;; define a lexicographic ordered polynomial set with 3 variables

2> (define lex-rational-xyz (lex-rational (list "x" "y" "z")))

;; define a polynomial set with two polynomials

3> (define S (list '((4 2 0 1) (-7 0 2 0)) '((1 1 1 2) (3 1 0 4)) ) )

;; see the polynomial set in the usual notation

4> (polys-string lex-rational-xyz S)

"[(4*x^2*z)+(-7*y^2),(x*y*z^2)+(3*x*z^4)]"

;; solve for Grobner Basis

5> (polys-string lex-rational-xyz (gbasis lex-rational-xyz S))

"[(y^3*z)+(3*y^2*z^3),(y^5)+(27*y^2*z^6),(x*y*z^2)+(3*x*z^4),(x^2*z)+(-7/4*y^2)]"

;; see if we can solve the same set of polynomial with graded-reverse-ordering

6> (define grevlex-rational-xyz (grevlex-rational (list "x" "y" "z")))
7> (polys-string grevlex-rational-xyz (gbasis grevlex-rational-xyz S))

"[(x^2*z)+(-7/4*y^2),(x*z^4)+(1/3*x*y*z^2),(y^2*z^3)+(1/3*y^3*z),(y^4*z^2)+(1/3*y^5),(x^2*y^5)+(21/4*y^6*z)]"

MIT

Contributions

;
; With code snippets from
; comp.lang.scheme
; http://mitpress.mit.edu/sicp/full-text/book/book.html
; http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html
; http://www-swiss.ai.mit.edu/~jaffer/SCM.html
; bit-scheme
;

(use numbers)