Changeset 1056
- Timestamp:
- 2015-06-10T08:56:43-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/parse.lisp
r1043 r1056 70 70 ;; (proclaim '(optimize safety))) 71 71 72 (defun convert-number (number-or-poly n)73 "Returns NUMBER-OR-POLY, if it is a polynomial. If it is a number,74 it converts it to the constant monomial in N variables. If the result75 is a number then convert it to a polynomial in N variables."76 (if (numberp number-or-poly)77 (make-poly-from-termlist (list (make-term (make-monom :dimension n) number-or-poly)))78 number-or-poly))79 80 (defun $poly+ (ring-and-order p q n)81 "Add two polynomials P and Q, where each polynomial is either a82 numeric constant or a polynomial in internal representation. If the83 result is a number then convert it to a polynomial in N variables."84 (poly-add ring-and-order (convert-number p n) (convert-number q n)))85 86 (defun $poly- (ring-and-order p q n)87 "Subtract two polynomials P and Q, where each polynomial is either a88 numeric constant or a polynomial in internal representation. If the89 result is a number then convert it to a polynomial in N variables."90 (poly-sub ring-and-order (convert-number p n) (convert-number q n)))91 92 (defun $minus-poly (ring p n)93 "Negation of P is a polynomial is either a numeric constant or a94 polynomial in internal representation. If the result is a number then95 convert it to a polynomial in N variables."96 (poly-uminus ring (convert-number p n)))97 98 (defun $poly* (ring-and-order p q n)99 "Multiply two polynomials P and Q, where each polynomial is either a100 numeric constant or a polynomial in internal representation. If the101 result is a number then convert it to a polynomial in N variables."102 (poly-mul ring-and-order (convert-number p n) (convert-number q n)))103 104 (defun $poly/ (ring p q)105 "Divide a polynomials P which is either a numeric constant or a106 polynomial in internal representation, by a number Q."107 (if (numberp p)108 (common-lisp:/ p q)109 (scalar-times-poly ring (common-lisp:/ q) p)))110 111 (defun $poly-expt (ring-and-order p l n)112 "Raise polynomial P, which is a polynomial in internal113 representation or a numeric constant, to power L. If P is a number,114 convert the result to a polynomial in N variables."115 (poly-expt ring-and-order (convert-number p n) l))116 72 117 73 (defun parse (&optional stream)
Note:
See TracChangeset
for help on using the changeset viewer.