#| SccsId="@(#)tests.lisp, version 1.7 of 5/14/94(11:23:03) *--------------------------------------------------------------------------* | Copyright (C) 1994, Marek Rychlik (e-mail: rychlik@math.arizona.edu) | | Department of Mathematics, University of Arizona, Tucson, AZ 85721 | | | | Everyone is permitted to copy, distribute and modify the code in this | | directory, as long as this copyright note is preserved verbatim. | *--------------------------------------------------------------------------* |# ;;(load "grobner-front-end") (defun run (test) (format t "Test ~a ~:[failed~;succeeded~]...~%" test (time (funcall test)))) (defun test-1 () (let* ((vars '(x y))) (equalp (mapcar #'(lambda (pred) (let* ((f (poly "4*x^2-3*x*y" vars pred)) (g (poly "4*x+5*y" vars pred))) (spoly f g pred))) (list #'lex> #'grlex> #'grevlex>)) (list (poly "-32*x*y" vars #'lex>) (poly "-32*x*y" vars #'grlex>) (poly "-32*x*y" vars #'grevlex>))))) (defun test-2 () (let* ((vars '(x y z))) (equalp (mapcar #'(lambda (pred) (let* ((f (poly "4*x^5-3*x*y-z^2" vars pred)) (g (poly-list "[4*x^3+5*y+z^2,y^2+z]" vars pred))) (normal-form f g pred))) (list #'lex> #'grlex> #'grevlex>)) (list (poly "-5*x^2*y-x^2*z^2-3*x*y-z^2" vars #'lex>) (poly "-X^2*Z^2-5*X^2*Y-3*X*Y-Z^2" vars #'grlex>) (poly "-X^2*Z^2-5*X^2*Y-3*X*Y-Z^2" vars #'grevlex>))))) ;; Find the equation of the Enneper surface (defun test-3 () (let* ((vars '(u v x y z)) (eqns (poly-list "[x-3*u-3*u*v^2+u^3,y-3*v-3*u^2*v+v^3,z-3*u^2+3*v^2]" vars)) (ans (poly-list "[X^6 - 3 * X^4 * Y^2 + 5/9 * X^4 * Z^3 + 6 * X^4 * Z^2 - 3 * X^4 * Z + 3 * X^2 * Y^4 + 26/9 * X^2 * Y^2 * Z^3 + 6 * X^2 * Y^2 * Z + 16/243 * X^2 * Z^6 + 16/9 * X^2 * Z^5 + 80/9 * X^2 * Z^4 - 16 * X^2 * Z^3 - Y^6 + 5/9 * Y^4 * Z^3 - 6 * Y^4 * Z^2 - 3 * Y^4 * Z - 16/243 * Y^2 * Z^6 + 16/9 * Y^2 * Z^5 - 80/9 * Y^2 * Z^4 - 16 * Y^2 * Z^3 - 64/19683 * Z^9 + 128/243 * Z^7 - 64/3 * Z^5]" vars))) (set-coefficient-ring nil) ;char=0 (equalp (elimination-ideal eqns 2) ans))) (defun test-4 () (let* ((vars '(x y)) (id1 (poly-list "[x-y^2,y^2*x]" vars)) (id2 (poly-list "[x^2-x*y^2,y^2]" vars)) (ans (poly-list "[x^2,y^4,x*y^2]" vars))) (equalp (ideal-intersection id1 id2) ans))) (defun test-5 () (let* ((vars '(x y z)) (f (poly-list "[x^5+y^4+z^3-1, x^3+y^2+z^2-1]" vars)) (ans (poly-list "[ X^2 * Z^4 + X^2 * Z^3 - 2 * X^2 * Z^2 - 1/6 * X * Z^10 - 2/3 * X * Z^9 - 1/4 * X * Z^8 + 7/6 * X * Z^7 - 1/12 * X * Z^6 - X * Z^5 + X * Z^4 + 1/2 * Y^10 * Z^2 + 1/3 * Y^10 * Z - 5/12 * Y^10 - 1/6 * Y^8 * Z^4 + 1/3 * Y^8 * Z^3 + 1/4 * Y^8 * Z^2 + 1/2 * Y^8 + Y^6 * Z^5 - 5/3 * Y^6 * Z^4 - 17/6 * Y^6 * Z^3 + 17/6 * Y^6 * Z^2 + 2/3 * Y^6 * Z - 1/3 * Y^6 - 1/3 * Y^4 * Z^7 - 7/2 * Y^4 * Z^6 - 3 * Y^4 * Z^5 + 131/12 * Y^4 * Z^4 + 23/4 * Y^4 * Z^3 - 13 * Y^4 * Z^2 - 8/3 * Y^4 * Z + 29/6 * Y^4 - 17/6 * Y^2 * Z^8 - 4 * Y^2 * Z^7 + 119/12 * Y^2 * Z^6 + 17/2 * Y^2 * Z^5 - 16 * Y^2 * Z^4 - 14/3 * Y^2 * Z^3 + 12 * Y^2 * Z^2 + 5/3 * Y^2 * Z - 55/12 * Y^2 - 7/6 * Z^10 - 7/6 * Z^9 + 55/12 * Z^8 + 21/4 * Z^7 - 31/4 * Z^6 - 15/2 * Z^5 + 83/12 * Z^4 + 41/12 * Z^3 - 31/12 * Z^2, X * Y^2 * Z - X * Y^2 - 1/8 * X * Z^10 - 7/24 * X * Z^9 + 1/2 * X * Z^8 + 7/8 * X * Z^7 - 23/24 * X * Z^6 + 1/2 * X * Z^4 - 1/2 * X * Z^3 - X * Z + X + 3/8 * Y^10 * Z^2 - 3/8 * Y^10 * Z - 7/24 * Y^10 - 1/8 * Y^8 * Z^4 + 11/24 * Y^8 * Z^3 - 3/8 * Y^8 * Z^2 + 1/4 * Y^8 * Z - 1/4 * Y^8 + 3/4 * Y^6 * Z^5 - 5/2 * Y^6 * Z^4 + 5/6 * Y^6 * Z^3 + 31/12 * Y^6 * Z^2 - Y^6 * Z - 1/3 * Y^6 - 1/4 * Y^4 * Z^7 - 53/24 * Y^4 * Z^6 + 11/6 * Y^4 * Z^5 + 113/12 * Y^4 * Z^4 - 55/8 * Y^4 * Z^3 - 29/4 * Y^4 * Z^2 + 15/4 * Y^4 * Z + 19/12 * Y^4 - 17/8 * Y^2 * Z^8 + 13/24 * Y^2 * Z^7 + 239/24 * Y^2 * Z^6 - 59/12 * Y^2 * Z^5 - 151/12 * Y^2 * Z^4 + 85/12 * Y^2 * Z^3 + 43/8 * Y^2 * Z^2 - 29/8 * Y^2 * Z + 7/24 * Y^2 - 7/8 * Z^10 + 7/12 * Z^9 + 31/8 * Z^8 - 11/12 * Z^7 - 103/12 * Z^6 + 17/6 * Z^5 + 127/24 * Z^4 - 3/2 * Z^3 - 17/24 * Z^2 + Z - 1, X * Z^11 + 4 * X * Z^10 + X * Z^9 - 10 * X * Z^8 - 4 * X * Z^7 + 8 * X * Z^6 - 3 * Y^10 * Z^3 - 2 * Y^10 * Z^2 + 4 * Y^10 * Z + 4 * Y^10 + Y^8 * Z^5 - 2 * Y^8 * Z^4 - 2 * Y^8 * Z^3 - 6 * Y^6 * Z^6 + 10 * Y^6 * Z^5 + 20 * Y^6 * Z^4 - 16 * Y^6 * Z^3 - 24 * Y^6 * Z^2 + 8 * Y^6 * Z + 8 * Y^6 + 2 * Y^4 * Z^8 + 21 * Y^4 * Z^7 + 17 * Y^4 * Z^6 - 78 * Y^4 * Z^5 - 64 * Y^4 * Z^4 + 90 * Y^4 * Z^3 + 76 * Y^4 * Z^2 - 32 * Y^4 * Z - 32 * Y^4 + 17 * Y^2 * Z^9 + 24 * Y^2 * Z^8 - 68 * Y^2 * Z^7 - 80 * Y^2 * Z^6 + 106 * Y^2 * Z^5 + 108 * Y^2 * Z^4 - 77 * Y^2 * Z^3 - 70 * Y^2 * Z^2 + 20 * Y^2 * Z + 20 * Y^2 + 7 * Z^11 + 7 * Z^10 - 31 * Z^9 - 42 * Z^8 + 55 * Z^7 + 77 * Z^6 - 39 * Z^5 - 62 * Z^4 + 8 * Z^3 + 20 * Z^2, Y^12 - Y^10 + 3 * Y^8 * Z^3 - 5 * Y^8 * Z^2 + 2 * Y^8 - 10 * Y^6 * Z^4 + 20 * Y^6 * Z^2 - 10 * Y^6 - 7 * Y^4 * Z^6 + 30 * Y^4 * Z^4 - 6 * Y^4 * Z^3 - 30 * Y^4 * Z^2 + 13 * Y^4 - 5 * Y^2 * Z^8 + 20 * Y^2 * Z^6 - 30 * Y^2 * Z^4 + 20 * Y^2 * Z^2 - 5 * Y^2 - Z^10 + Z^9 + 5 * Z^8 - 13 * Z^6 + 10 * Z^4 + 3 * Z^3 - 5 * Z^2, X * Y^4 + X * Z^3 - X + Y^4 + 2 * Y^2 * Z^2 - 2 * Y^2 + Z^4 - 2 * Z^2 + 1, X^2 * Y^2 + X^2 * Z^2 - X^2 - Y^4 - Z^3 + 1, X^3 + Y^2 + Z^2 - 1 ]" vars))) (equalp (grobner f :reduce t) ans))) (defun test-6 () (let* ((vars '(x y z)) (f (poly-list "[x^5+y^4+z^3-1,x^3+y^3+z^2-1]" vars)) (ans (poly-list "[x]" vars))) ;unknown yet (equalp (grobner f :reduce t) ans))) ;;---------------------------------------------------------------- (defun run-short-tests () (dolist (test '(test-1 test-2 test-4)) (run test))) (defun run-long-tests () (dolist (test '(test-3 test-5)) (run test)))