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 1056


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

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/parse.lisp

    r1043 r1056  
    7070;;  (proclaim '(optimize safety)))
    7171
    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 result
    75 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 a
    82 numeric constant or a polynomial in internal representation. If the
    83 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 a
    88 numeric constant or a polynomial in internal representation. If the
    89 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 a
    94 polynomial in internal representation. If the result is a number then
    95 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 a
    100 numeric constant or a polynomial in internal representation. If the
    101 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 a
    106 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 internal
    113 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))
    11672
    11773(defun parse (&optional stream)
Note: See TracChangeset for help on using the changeset viewer.