close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

source: branches/f4grobner/grobner.lisp@ 107

Last change on this file since 107 was 107, checked in by Marek Rychlik, 9 years ago

* empty log message *

File size: 20.8 KB
Line 
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23;;
24;; Global switches
25;;
26;; Can be used in Maxima just fine, as they observe the
27;; Maxima naming convention, i.e. all names visible at the
28;; Maxima toplevel begin with a '$'.
29;;
30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
31
32(defvar $poly_monomial_order '$lex
33 "This switch controls which monomial order is used in polynomial
34and Grobner basis calculations. If not set, LEX will be used")
35
36(defvar $poly_coefficient_ring '$expression_ring
37 "This switch indicates the coefficient ring of the polynomials
38that will be used in grobner calculations. If not set, Maxima's
39general expression ring will be used. This variable may be set
40to RING_OF_INTEGERS if desired.")
41
42(defvar $poly_primary_elimination_order nil
43 "Name of the default order for eliminated variables in elimination-based functions.
44If not set, LEX will be used.")
45
46(defvar $poly_secondary_elimination_order nil
47 "Name of the default order for kept variables in elimination-based functions.
48If not set, LEX will be used.")
49
50(defvar $poly_elimination_order nil
51 "Name of the default elimination order used in elimination calculations.
52If set, it overrides the settings in variables POLY_PRIMARY_ELIMINATION_ORDER
53and SECONDARY_ELIMINATION_ORDER. The user must ensure that this is a true
54elimination order valid for the number of eliminated variables.")
55
56(defvar $poly_return_term_list nil
57 "If set to T, all functions in this package will return each polynomial as a
58list of terms in the current monomial order rather than a Maxima general expression.")
59
60(defvar $poly_grobner_debug nil
61 "If set to TRUE, produce debugging and tracing output.")
62
63(defvar $poly_grobner_algorithm '$buchberger
64 "The name of the algorithm used to find grobner bases.")
65
66(defvar $poly_top_reduction_only nil
67 "If not FALSE, use top reduction only whenever possible.
68Top reduction means that division algorithm stops after the first reduction.")
69
70
71
72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
73;;
74;; Coefficient ring operations
75;;
76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77;;
78;; These are ALL operations that are performed on the coefficients by
79;; the package, and thus the coefficient ring can be changed by merely
80;; redefining these operations.
81;;
82;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
83
84(defstruct (ring)
85 (parse #'identity :type function)
86 (unit #'identity :type function)
87 (zerop #'identity :type function)
88 (add #'identity :type function)
89 (sub #'identity :type function)
90 (uminus #'identity :type function)
91 (mul #'identity :type function)
92 (div #'identity :type function)
93 (lcm #'identity :type function)
94 (ezgcd #'identity :type function)
95 (gcd #'identity :type function))
96
97(defparameter *ring-of-integers*
98 (make-ring
99 :parse #'identity
100 :unit #'(lambda () 1)
101 :zerop #'zerop
102 :add #'+
103 :sub #'-
104 :uminus #'-
105 :mul #'*
106 :div #'/
107 :lcm #'lcm
108 :ezgcd #'(lambda (x y &aux (c (gcd x y))) (values c (/ x c) (/ y c)))
109 :gcd #'gcd)
110 "The ring of integers.")
111
112
113
114;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115;;
116;; This is how we perform operations on coefficients
117;; using Maxima functions.
118;;
119;; Functions and macros dealing with internal representation structure
120;;
121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
122
123
124;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
125;;
126;; Debugging/tracing
127;;
128;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
129(defmacro debug-cgb (&rest args)
130 `(when $poly_grobner_debug (format *terminal-io* ,@args)))
131
132
133
134;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
135;;
136;; These are provided mostly for debugging purposes To enable
137;; verification of grobner bases with BUCHBERGER-CRITERION, do
138;; (pushnew :grobner-check *features*) and compile/load this file.
139;; With this feature, the calculations will slow down CONSIDERABLY.
140;;
141;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
142
143(defun grobner-test (ring g f)
144 "Test whether G is a Grobner basis and F is contained in G. Return T
145upon success and NIL otherwise."
146 (debug-cgb "~&GROBNER CHECK: ")
147 (let (($poly_grobner_debug nil)
148 (stat1 (buchberger-criterion ring g))
149 (stat2
150 (every #'poly-zerop
151 (makelist (normal-form ring (copy-tree (elt f i)) g nil)
152 (i 0 (1- (length f)))))))
153 (unless stat1 (error "~&Buchberger criterion failed."))
154 (unless stat2
155 (error "~&Original polys not in ideal spanned by Grobner.")))
156 (debug-cgb "~&GROBNER CHECK END")
157 t)
158
159
160;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
161;;
162;; Selection of algorithm and pair heuristic
163;;
164;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
165
166(defun find-grobner-function (algorithm)
167 "Return a function which calculates Grobner basis, based on its
168names. Names currently used are either Lisp symbols, Maxima symbols or
169keywords."
170 (ecase algorithm
171 ((buchberger :buchberger $buchberger) #'buchberger)
172 ((parallel-buchberger :parallel-buchberger $parallel_buchberger) #'parallel-buchberger)
173 ((gebauer-moeller :gebauer_moeller $gebauer_moeller) #'gebauer-moeller)))
174
175(defun grobner (ring f &optional (start 0) (top-reduction-only nil))
176 ;;(setf F (sort F #'< :key #'sugar))
177 (funcall
178 (find-grobner-function $poly_grobner_algorithm)
179 ring f start top-reduction-only))
180
181(defun reduced-grobner (ring f &optional (start 0) (top-reduction-only $poly_top_reduction_only))
182 (reduction ring (grobner ring f start top-reduction-only)))
183
184(defun set-pair-heuristic (method)
185 "Sets up variables *PAIR-KEY-FUNCTION* and *PAIR-ORDER* used
186to determine the priority of critical pairs in the priority queue."
187 (ecase method
188 ((sugar :sugar $sugar)
189 (setf *pair-key-function* #'sugar-pair-key
190 *pair-order* #'sugar-order))
191; ((minimal-mock-spoly :minimal-mock-spoly $minimal_mock_spoly)
192; (setf *pair-key-function* #'mock-spoly
193; *pair-order* #'mock-spoly-order))
194 ((minimal-lcm :minimal-lcm $minimal_lcm)
195 (setf *pair-key-function* #'(lambda (p q)
196 (monom-lcm (poly-lm p) (poly-lm q)))
197 *pair-order* #'reverse-monomial-order))
198 ((minimal-total-degree :minimal-total-degree $minimal_total_degree)
199 (setf *pair-key-function* #'(lambda (p q)
200 (monom-total-degree
201 (monom-lcm (poly-lm p) (poly-lm q))))
202 *pair-order* #'<))
203 ((minimal-length :minimal-length $minimal_length)
204 (setf *pair-key-function* #'(lambda (p q)
205 (+ (poly-length p) (poly-length q)))
206 *pair-order* #'<))))
207
208
209
210
211;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
212;;
213;; Set up the coefficients to be polynomials
214;;
215;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
216
217;; (defun poly-ring (ring vars)
218;; (make-ring
219;; :parse #'(lambda (expr) (poly-eval ring expr vars))
220;; :unit #'(lambda () (poly-unit ring (length vars)))
221;; :zerop #'poly-zerop
222;; :add #'(lambda (x y) (poly-add ring x y))
223;; :sub #'(lambda (x y) (poly-sub ring x y))
224;; :uminus #'(lambda (x) (poly-uminus ring x))
225;; :mul #'(lambda (x y) (poly-mul ring x y))
226;; :div #'(lambda (x y) (poly-exact-divide ring x y))
227;; :lcm #'(lambda (x y) (poly-lcm ring x y))
228;; :ezgcd #'(lambda (x y &aux (gcd (poly-gcd ring x y)))
229;; (values gcd
230;; (poly-exact-divide ring x gcd)
231;; (poly-exact-divide ring y gcd)))
232;; :gcd #'(lambda (x y) (poly-gcd x y))))
233
234
235
236;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
237;;
238;; Conversion from internal to infix form
239;;
240;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
241
242(defun coerce-to-infix (poly-type object vars)
243 (case poly-type
244 (:termlist
245 `(+ ,@(mapcar #'(lambda (term) (coerce-to-infix :term term vars)) object)))
246 (:polynomial
247 (coerce-to-infix :termlist (poly-termlist object) vars))
248 (:poly-list
249 `([ ,@(mapcar #'(lambda (p) (coerce-to-infix :polynomial p vars)) object)))
250 (:term
251 `(* ,(term-coeff object)
252 ,@(mapcar #'(lambda (var power) `(expt ,var ,power))
253 vars (monom-exponents (term-monom object)))))
254 (otherwise
255 object)))
256
257
258;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
259;;
260;; Order utilities
261;;
262;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
263(defun find-order (order)
264 "This function returns the order function bases on its name."
265 (cond
266 ((null order) nil)
267 ((symbolp order)
268 (case order
269 ((lex :lex $lex) #'lex>)
270 ((grlex :grlex $grlex) #'grlex>)
271 ((grevlex :grevlex $grevlex) #'grevlex>)
272 ((invlex :invlex $invlex) #'invlex>)
273 ((elimination-order-1 :elimination-order-1 elimination_order_1) #'elimination-order-1)
274 (otherwise
275 (mtell "~%Warning: Order ~M not found. Using default.~%" order))))
276 (t
277 (mtell "~%Order specification ~M is not recognized. Using default.~%" order)
278 nil)))
279
280(defun find-ring (ring)
281 "This function returns the ring structure bases on input symbol."
282 (cond
283 ((null ring) nil)
284 ((symbolp ring)
285 (case ring
286 ((expression-ring :expression-ring $expression_ring) *expression-ring*)
287 ((ring-of-integers :ring-of-integers $ring_of_integers) *ring-of-integers*)
288 (otherwise
289 (mtell "~%Warning: Ring ~M not found. Using default.~%" ring))))
290 (t
291 (mtell "~%Ring specification ~M is not recognized. Using default.~%" ring)
292 nil)))
293
294(defmacro with-monomial-order ((order) &body body)
295 "Evaluate BODY with monomial order set to ORDER."
296 `(let ((*monomial-order* (or (find-order ,order) *monomial-order*)))
297 . ,body))
298
299(defmacro with-coefficient-ring ((ring) &body body)
300 "Evaluate BODY with coefficient ring set to RING."
301 `(let ((*maxima-ring* (or (find-ring ,ring) *maxima-ring*)))
302 . ,body))
303
304(defmacro with-elimination-orders ((primary secondary elimination-order)
305 &body body)
306 "Evaluate BODY with primary and secondary elimination orders set to PRIMARY and SECONDARY."
307 `(let ((*primary-elimination-order* (or (find-order ,primary) *primary-elimination-order*))
308 (*secondary-elimination-order* (or (find-order ,secondary) *secondary-elimination-order*))
309 (*elimination-order* (or (find-order ,elimination-order) *elimination-order*)))
310 . ,body))
311
312
313
314;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
315;;
316;; Conversion from internal form to Maxima general form
317;;
318;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
319
320(defun maxima-head ()
321 (if $poly_return_term_list
322 '(mlist)
323 '(mplus)))
324
325(defun coerce-to-maxima (poly-type object vars)
326 (case poly-type
327 (:polynomial
328 `(,(maxima-head) ,@(mapcar #'(lambda (term) (coerce-to-maxima :term term vars)) (poly-termlist object))))
329 (:poly-list
330 `((mlist) ,@(mapcar #'(lambda (p) ($ratdisrep (coerce-to-maxima :polynomial p vars))) object)))
331 (:term
332 `((mtimes) ,($ratdisrep (term-coeff object))
333 ,@(mapcar #'(lambda (var power) `((mexpt) ,var ,power))
334 vars (monom-exponents (term-monom object)))))
335 ;; Assumes that Lisp and Maxima logicals coincide
336 (:logical object)
337 (otherwise
338 object)))
339
340
341
342;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
343;;
344;; Macro facility for writing Maxima-level wrappers for
345;; functions operating on internal representation
346;;
347;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
348
349(defmacro with-parsed-polynomials (((maxima-vars &optional (maxima-new-vars nil new-vars-supplied-p))
350 &key (polynomials nil)
351 (poly-lists nil)
352 (poly-list-lists nil)
353 (value-type nil))
354 &body body
355 &aux (vars (gensym))
356 (new-vars (gensym)))
357 `(let ((,vars (coerce-maxima-list ,maxima-vars))
358 ,@(when new-vars-supplied-p
359 (list `(,new-vars (coerce-maxima-list ,maxima-new-vars)))))
360 (coerce-to-maxima
361 ,value-type
362 (with-coefficient-ring ($poly_coefficient_ring)
363 (with-monomial-order ($poly_monomial_order)
364 (with-elimination-orders ($poly_primary_elimination_order
365 $poly_secondary_elimination_order
366 $poly_elimination_order)
367 (let ,(let ((args nil))
368 (dolist (p polynomials args)
369 (setf args (cons `(,p (parse-poly ,p ,vars)) args)))
370 (dolist (p poly-lists args)
371 (setf args (cons `(,p (parse-poly-list ,p ,vars)) args)))
372 (dolist (p poly-list-lists args)
373 (setf args (cons `(,p (parse-poly-list-list ,p ,vars)) args))))
374 . ,body))))
375 ,(if new-vars-supplied-p
376 `(append ,vars ,new-vars)
377 vars))))
378
379(defmacro define-unop (maxima-name fun-name
380 &optional (documentation nil documentation-supplied-p))
381 "Define a MAXIMA-level unary operator MAXIMA-NAME corresponding to unary function FUN-NAME."
382 `(defun ,maxima-name (p vars
383 &aux
384 (vars (coerce-maxima-list vars))
385 (p (parse-poly p vars)))
386 ,@(when documentation-supplied-p (list documentation))
387 (coerce-to-maxima :polynomial (,fun-name *maxima-ring* p) vars)))
388
389(defmacro define-binop (maxima-name fun-name
390 &optional (documentation nil documentation-supplied-p))
391 "Define a MAXIMA-level binary operator MAXIMA-NAME corresponding to binary function FUN-NAME."
392 `(defmfun ,maxima-name (p q vars
393 &aux
394 (vars (coerce-maxima-list vars))
395 (p (parse-poly p vars))
396 (q (parse-poly q vars)))
397 ,@(when documentation-supplied-p (list documentation))
398 (coerce-to-maxima :polynomial (,fun-name *maxima-ring* p q) vars)))
399
400
401
402;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
403;;
404;; Maxima-level interface functions
405;;
406;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
407
408;; Auxillary function for removing zero polynomial
409(defun remzero (plist) (remove #'poly-zerop plist))
410
411;;Simple operators
412
413(define-binop $poly_add poly-add
414 "Adds two polynomials P and Q")
415
416(define-binop $poly_subtract poly-sub
417 "Subtracts a polynomial Q from P.")
418
419(define-binop $poly_multiply poly-mul
420 "Returns the product of polynomials P and Q.")
421
422(define-binop $poly_s_polynomial spoly
423 "Returns the syzygy polynomial (S-polynomial) of two polynomials P and Q.")
424
425(define-unop $poly_primitive_part poly-primitive-part
426 "Returns the polynomial P divided by GCD of its coefficients.")
427
428(define-unop $poly_normalize poly-normalize
429 "Returns the polynomial P divided by the leading coefficient.")
430
431;;Functions
432
433(defmfun $poly_expand (p vars)
434 "This function is equivalent to EXPAND(P) if P parses correctly to a polynomial.
435If the representation is not compatible with a polynomial in variables VARS,
436the result is an error."
437 (with-parsed-polynomials ((vars) :polynomials (p)
438 :value-type :polynomial)
439 p))
440
441(defmfun $poly_expt (p n vars)
442 (with-parsed-polynomials ((vars) :polynomials (p) :value-type :polynomial)
443 (poly-expt *maxima-ring* p n)))
444
445(defmfun $poly_content (p vars)
446 (with-parsed-polynomials ((vars) :polynomials (p))
447 (poly-content *maxima-ring* p)))
448
449(defmfun $poly_pseudo_divide (f fl vars
450 &aux (vars (coerce-maxima-list vars))
451 (f (parse-poly f vars))
452 (fl (parse-poly-list fl vars)))
453 (multiple-value-bind (quot rem c division-count)
454 (poly-pseudo-divide *maxima-ring* f fl)
455 `((mlist)
456 ,(coerce-to-maxima :poly-list quot vars)
457 ,(coerce-to-maxima :polynomial rem vars)
458 ,c
459 ,division-count)))
460
461(defmfun $poly_exact_divide (f g vars)
462 (with-parsed-polynomials ((vars) :polynomials (f g) :value-type :polynomial)
463 (poly-exact-divide *maxima-ring* f g)))
464
465(defmfun $poly_normal_form (f fl vars)
466 (with-parsed-polynomials ((vars) :polynomials (f)
467 :poly-lists (fl)
468 :value-type :polynomial)
469 (normal-form *maxima-ring* f (remzero fl) nil)))
470
471(defmfun $poly_buchberger_criterion (g vars)
472 (with-parsed-polynomials ((vars) :poly-lists (g) :value-type :logical)
473 (buchberger-criterion *maxima-ring* g)))
474
475(defmfun $poly_buchberger (fl vars)
476 (with-parsed-polynomials ((vars) :poly-lists (fl) :value-type :poly-list)
477 (buchberger *maxima-ring* (remzero fl) 0 nil)))
478
479(defmfun $poly_reduction (plist vars)
480 (with-parsed-polynomials ((vars) :poly-lists (plist)
481 :value-type :poly-list)
482 (reduction *maxima-ring* plist)))
483
484(defmfun $poly_minimization (plist vars)
485 (with-parsed-polynomials ((vars) :poly-lists (plist)
486 :value-type :poly-list)
487 (minimization plist)))
488
489(defmfun $poly_normalize_list (plist vars)
490 (with-parsed-polynomials ((vars) :poly-lists (plist)
491 :value-type :poly-list)
492 (poly-normalize-list *maxima-ring* plist)))
493
494(defmfun $poly_grobner (f vars)
495 (with-parsed-polynomials ((vars) :poly-lists (f)
496 :value-type :poly-list)
497 (grobner *maxima-ring* (remzero f))))
498
499(defmfun $poly_reduced_grobner (f vars)
500 (with-parsed-polynomials ((vars) :poly-lists (f)
501 :value-type :poly-list)
502 (reduced-grobner *maxima-ring* (remzero f))))
503
504(defmfun $poly_depends_p (p var mvars
505 &aux (vars (coerce-maxima-list mvars))
506 (pos (position var vars)))
507 (if (null pos)
508 (merror "~%Variable ~M not in the list of variables ~M." var mvars)
509 (poly-depends-p (parse-poly p vars) pos)))
510
511(defmfun $poly_elimination_ideal (flist k vars)
512 (with-parsed-polynomials ((vars) :poly-lists (flist)
513 :value-type :poly-list)
514 (elimination-ideal *maxima-ring* flist k nil 0)))
515
516(defmfun $poly_colon_ideal (f g vars)
517 (with-parsed-polynomials ((vars) :poly-lists (f g) :value-type :poly-list)
518 (colon-ideal *maxima-ring* f g nil)))
519
520(defmfun $poly_ideal_intersection (f g vars)
521 (with-parsed-polynomials ((vars) :poly-lists (f g) :value-type :poly-list)
522 (ideal-intersection *maxima-ring* f g nil)))
523
524(defmfun $poly_lcm (f g vars)
525 (with-parsed-polynomials ((vars) :polynomials (f g) :value-type :polynomial)
526 (poly-lcm *maxima-ring* f g)))
527
528(defmfun $poly_gcd (f g vars)
529 ($first ($divide (m* f g) ($poly_lcm f g vars))))
530
531(defmfun $poly_grobner_equal (g1 g2 vars)
532 (with-parsed-polynomials ((vars) :poly-lists (g1 g2))
533 (grobner-equal *maxima-ring* g1 g2)))
534
535(defmfun $poly_grobner_subsetp (g1 g2 vars)
536 (with-parsed-polynomials ((vars) :poly-lists (g1 g2))
537 (grobner-subsetp *maxima-ring* g1 g2)))
538
539(defmfun $poly_grobner_member (p g vars)
540 (with-parsed-polynomials ((vars) :polynomials (p) :poly-lists (g))
541 (grobner-member *maxima-ring* p g)))
542
543(defmfun $poly_ideal_saturation1 (f p vars)
544 (with-parsed-polynomials ((vars) :poly-lists (f) :polynomials (p)
545 :value-type :poly-list)
546 (ideal-saturation-1 *maxima-ring* f p 0)))
547
548(defmfun $poly_saturation_extension (f plist vars new-vars)
549 (with-parsed-polynomials ((vars new-vars)
550 :poly-lists (f plist)
551 :value-type :poly-list)
552 (saturation-extension *maxima-ring* f plist)))
553
554(defmfun $poly_polysaturation_extension (f plist vars new-vars)
555 (with-parsed-polynomials ((vars new-vars)
556 :poly-lists (f plist)
557 :value-type :poly-list)
558 (polysaturation-extension *maxima-ring* f plist)))
559
560(defmfun $poly_ideal_polysaturation1 (f plist vars)
561 (with-parsed-polynomials ((vars) :poly-lists (f plist)
562 :value-type :poly-list)
563 (ideal-polysaturation-1 *maxima-ring* f plist 0 nil)))
564
565(defmfun $poly_ideal_saturation (f g vars)
566 (with-parsed-polynomials ((vars) :poly-lists (f g)
567 :value-type :poly-list)
568 (ideal-saturation *maxima-ring* f g 0 nil)))
569
570(defmfun $poly_ideal_polysaturation (f ideal-list vars)
571 (with-parsed-polynomials ((vars) :poly-lists (f)
572 :poly-list-lists (ideal-list)
573 :value-type :poly-list)
574 (ideal-polysaturation *maxima-ring* f ideal-list 0 nil)))
575
576(defmfun $poly_lt (f vars)
577 (with-parsed-polynomials ((vars) :polynomials (f) :value-type :polynomial)
578 (make-poly-from-termlist (list (poly-lt f)))))
579
580(defmfun $poly_lm (f vars)
581 (with-parsed-polynomials ((vars) :polynomials (f) :value-type :polynomial)
582 (make-poly-from-termlist (list (make-term (poly-lm f) (funcall (ring-unit *maxima-ring*)))))))
583
Note: See TracBrowser for help on using the repository browser.