Changeset 1057 for branches/f4grobner
- Timestamp:
- 2015-06-10T08:56:56-07:00 (9 years ago)
- 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, 3 it converts it to the constant monomial in N variables. If the result 4 is 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 11 numeric constant or a polynomial in internal representation. If the 12 result 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 17 numeric constant or a polynomial in internal representation. If the 18 result 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 23 polynomial in internal representation. If the result is a number then 24 convert 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 29 numeric constant or a polynomial in internal representation. If the 30 result 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 35 polynomial 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 42 representation or a numeric constant, to power L. If P is a number, 43 convert the result to a polynomial in N variables." 44 (poly-expt ring-and-order (convert-number p n) l)) 45 46 1 47 (defun variable-basis (ring n &aux (basis (make-list n))) 2 48 "Generate a list of polynomials X[i], i=0,1,...,N-1."
Note:
See TracChangeset
for help on using the changeset viewer.