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@ 101

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

* empty log message *

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