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/mx-grobner.lisp@ 99

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

* empty log message *

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