Changeset 4346
- Timestamp:
- 2016-06-06T13:26:28-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/symbolic-polynomial.lisp
r4202 r4346 21 21 22 22 (defpackage "SYMBOLIC-POLYNOMIAL" 23 (:use :cl :utils :monom :polynomial :infix :infix-printer )23 (:use :cl :utils :monom :polynomial :infix :infix-printer :ring) 24 24 (:export "SYMBOLIC-POLY" "READ-INFIX-FORM" "STRING->POLY" "POLY->STRING" "->INFIX") 25 25 (:documentation "Implements symbolic polynomials. A symbolic … … 105 105 (defun read-poly (vars &key 106 106 (stream t) 107 (order #'lex>)) 107 (order #'lex>) 108 (coefficient-class 'rational-field)) 108 109 "Reads an expression in prefix form from a stream STREAM. 109 110 The expression read from the strem should represent a polynomial or a … … 111 112 polynomial or list of polynomials is returned, with terms in each 112 113 polynomial ordered according to monomial order ORDER." 113 (poly-eval (read-infix-form :stream stream) vars order ))114 (poly-eval (read-infix-form :stream stream) vars order coefficient-class)) 114 115 115 116 (defun string->poly (str vars 116 117 &optional 117 (order #'lex>)) 118 (order #'lex>) 119 (coefficient-class 'rational-field)) 118 120 "Converts a string STR to a polynomial in variables VARS." 119 121 (with-input-from-string (s str) 120 (let ((p-or-plist (read-poly vars :stream s :order order )))122 (let ((p-or-plist (read-poly vars :stream s :order order :coefficient-class coefficient-class))) 121 123 (etypecase p-or-plist 122 124 (poly (change-class p-or-plist 'symbolic-poly :vars vars)) … … 138 140 (defun string->alist (str vars 139 141 &optional 140 (order #'lex>)) 142 (order #'lex>) 143 (coefficient-class 'rational-field)) 141 144 "Convert a string STR representing a polynomial or polynomial list to 142 145 an association list (... (MONOM . COEFF) ...)." 143 (poly->alist (string->poly str vars order )))146 (poly->alist (string->poly str vars order coefficient-class))) 144 147 145 148 (defun poly-equal-no-sugar-p (p q)
Note:
See TracChangeset
for help on using the changeset viewer.