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 1057 for branches/f4grobner


Ignore:
Timestamp:
2015-06-10T08:56:56-07:00 (9 years ago)
Author:
Marek Rychlik
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/.junk/poly-eval.lisp

    r1055 r1057  
     1(defun convert-number (number-or-poly n)
     2  "Returns NUMBER-OR-POLY, if it is a polynomial. If it is a number,
     3it converts it to the constant monomial in N variables. If the result
     4is a number then convert it to a polynomial in N variables."
     5  (if (numberp number-or-poly)
     6      (make-poly-from-termlist (list (make-term (make-monom :dimension n) number-or-poly)))
     7      number-or-poly))
     8
     9(defun $poly+ (ring-and-order p q n)
     10  "Add two polynomials P and Q, where each polynomial is either a
     11numeric constant or a polynomial in internal representation. If the
     12result is a number then convert it to a polynomial in N variables."
     13  (poly-add ring-and-order (convert-number p n) (convert-number q n)))
     14
     15(defun $poly- (ring-and-order p q n)
     16  "Subtract two polynomials P and Q, where each polynomial is either a
     17numeric constant or a polynomial in internal representation. If the
     18result is a number then convert it to a polynomial in N variables."
     19  (poly-sub ring-and-order (convert-number p n) (convert-number q n)))
     20
     21(defun $minus-poly (ring p n)
     22  "Negation of P is a polynomial is either a numeric constant or a
     23polynomial in internal representation. If the result is a number then
     24convert it to a polynomial in N variables."
     25  (poly-uminus ring (convert-number p n)))
     26
     27(defun $poly* (ring-and-order p q n)
     28  "Multiply two polynomials P and Q, where each polynomial is either a
     29numeric constant or a polynomial in internal representation. If the
     30result is a number then convert it to a polynomial in N variables."
     31  (poly-mul ring-and-order (convert-number p n) (convert-number q n)))
     32
     33(defun $poly/ (ring p q)
     34  "Divide a polynomials P which is either a numeric constant or a
     35polynomial in internal representation, by a number Q."
     36  (if (numberp p)
     37      (common-lisp:/ p q)
     38      (scalar-times-poly ring (common-lisp:/ q) p)))
     39   
     40(defun $poly-expt (ring-and-order p l n)
     41  "Raise polynomial P, which is a polynomial in internal
     42representation or a numeric constant, to power L. If P is a number,
     43convert the result to a polynomial in N variables."
     44  (poly-expt ring-and-order (convert-number p n) l))
     45
     46
    147(defun variable-basis (ring n &aux (basis (make-list n)))
    248  "Generate a list of polynomials X[i], i=0,1,...,N-1."
Note: See TracChangeset for help on using the changeset viewer.