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.

Changeset 55 for branches/f4grobner


Ignore:
Timestamp:
2015-06-05T11:18:00-07:00 (10 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/polynomial.lisp

    r53 r55  
    188188          (coerce-coeff ring expr vars)))))))
    189189
    190 
    191 
     190(defun spoly (ring f g)
     191  "It yields the S-polynomial of polynomials F and G."
     192  (declare (type poly f g))
     193  (let* ((lcm (monom-lcm (poly-lm f) (poly-lm g)))
     194          (mf (monom-div lcm (poly-lm f)))
     195          (mg (monom-div lcm (poly-lm g))))
     196    (declare (type monom mf mg))
     197    (multiple-value-bind (c cf cg)
     198        (funcall (ring-ezgcd ring) (poly-lc f) (poly-lc g))
     199      (declare (ignore c))
     200      (poly-sub
     201       ring
     202       (scalar-times-poly ring cg (monom-times-poly mf f))
     203       (scalar-times-poly ring cf (monom-times-poly mg g))))))
     204
     205
     206(defun poly-primitive-part (ring p)
     207  "Divide polynomial P with integer coefficients by gcd of its
     208coefficients and return the result."
     209  (declare (type poly p))
     210  (if (poly-zerop p)
     211      (values p 1)
     212    (let ((c (poly-content ring p)))
     213      (values (make-poly-from-termlist (mapcar
     214                          #'(lambda (x)
     215                              (make-term (term-monom x)
     216                                         (funcall (ring-div ring) (term-coeff x) c)))
     217                          (poly-termlist p))
     218                         (poly-sugar p))
     219               c))))
     220
     221(defun poly-content (ring p)
     222  "Greatest common divisor of the coefficients of the polynomial P. Use the RING structure
     223to compute the greatest common divisor."
     224  (declare (type poly p))
     225  (reduce (ring-gcd ring) (mapcar #'term-coeff (rest (poly-termlist p))) :initial-value (poly-lc p)))
Note: See TracChangeset for help on using the changeset viewer.