| 1 | ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*-
|
---|
| 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 3 | ;;;
|
---|
| 4 | ;;; Copyright (C) 1999, 2002, 2009, 2015 Marek Rychlik <rychlik@u.arizona.edu>
|
---|
| 5 | ;;;
|
---|
| 6 | ;;; This program is free software; you can redistribute it and/or modify
|
---|
| 7 | ;;; it under the terms of the GNU General Public License as published by
|
---|
| 8 | ;;; the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | ;;; (at your option) any later version.
|
---|
| 10 | ;;;
|
---|
| 11 | ;;; This program is distributed in the hope that it will be useful,
|
---|
| 12 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | ;;; GNU General Public License for more details.
|
---|
| 15 | ;;;
|
---|
| 16 | ;;; You should have received a copy of the GNU General Public License
|
---|
| 17 | ;;; along with this program; if not, write to the Free Software
|
---|
| 18 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
| 19 | ;;;
|
---|
| 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 21 |
|
---|
| 22 | (in-package :ngrobner)
|
---|
| 23 |
|
---|
| 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 25 | ;;
|
---|
| 26 | ;; Standard postprocessing of Grobner bases:
|
---|
| 27 | ;; - reduction
|
---|
| 28 | ;; - minimization
|
---|
| 29 | ;;
|
---|
| 30 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
---|
| 31 |
|
---|
| 32 | (defun reduction (ring plist)
|
---|
| 33 | "Reduce a list of polynomials PLIST, so that non of the terms in any of
|
---|
| 34 | the polynomials is divisible by a leading monomial of another
|
---|
| 35 | polynomial. Return the reduced list."
|
---|
| 36 | (do ((q plist)
|
---|
| 37 | (found t))
|
---|
| 38 | ((not found)
|
---|
| 39 | (mapcar #'(lambda (x) (poly-primitive-part ring x)) q))
|
---|
| 40 | ;;Find p in Q such that p is reducible mod Q\{p}
|
---|
| 41 | (setf found nil)
|
---|
| 42 | (dolist (x q)
|
---|
| 43 | (let ((q1 (remove x q)))
|
---|
| 44 | (multiple-value-bind (h c div-count)
|
---|
| 45 | (normal-form ring x q1 nil #| not a top reduction! |# )
|
---|
| 46 | (declare (ignore c))
|
---|
| 47 | (unless (zerop div-count)
|
---|
| 48 | (setf found t q q1)
|
---|
| 49 | (unless (poly-zerop h)
|
---|
| 50 | (setf q (nconc q1 (list h))))
|
---|
| 51 | (return)))))))
|
---|
| 52 |
|
---|
| 53 | (defun minimization (p)
|
---|
| 54 | "Returns a sublist of the polynomial list P spanning the same
|
---|
| 55 | monomial ideal as P but minimal, i.e. no leading monomial
|
---|
| 56 | of a polynomial in the sublist divides the leading monomial
|
---|
| 57 | of another polynomial."
|
---|
| 58 | (do ((q p)
|
---|
| 59 | (found t))
|
---|
| 60 | ((not found) q)
|
---|
| 61 | ;;Find p in Q such that lm(p) is in LM(Q\{p})
|
---|
| 62 | (setf found nil
|
---|
| 63 | q (dolist (x q q)
|
---|
| 64 | (let ((q1 (remove x q)))
|
---|
| 65 | (when (member-if #'(lambda (p) (monom-divides-p (poly-lm x) (poly-lm p))) q1)
|
---|
| 66 | (setf found t)
|
---|
| 67 | (return q1)))))))
|
---|