Based on "Ideals, Varieties, and Algorithms (D. Cox, et. al.), I wrote a simple scala programs for Buchberger algorithm and supporting library for computer algebra system.
Sample codes are shown in scala worksheet
which can be played in Eclipse with scala worksheet plugin.
The unit-test codes are also useful to understand usage of the library.
This library is aimed for solving the exercises of the textbook rather than practical use.
- package basic
- package.scala : Defines implicit conversions from string.
- Q.scala : Defines trait
Fieldand its implementation of
Q, rational number.
- MonomialOrder.scala : Defines trait
MonomialOrderand its implementations
- Mono.scala : Defines
- Term.scala : Defines trait
QTerm, its implementation on
- Poly.scala : Defines trait
QPoly, its implementation on
- QWorksheet.sc : scala worksheet for demonstrations.
Conversions from String
The library defines some implicit conversions from
Conversions require monomial order object as
implicit val or explicit argument.
"<polynomial>".poly : conversion to QPoly "<term>".term : conversion to QTerm "<monomial>".mono : conversion to Mono "<rational>".q : conversion to Q
Those BNFs are as follows:
<polynomial> ::= <term> | <term> " + " <polynomial> | <term> " - " <polynomial>. <term> ::= <monomial> ;; coefficient = 1 | "-" <monomial" ;; coefficient = -1 | <integer> <monomial> ;; coefficient = integer | <rational> <monomial> ;; coefficient = rational | <integer> ;; monomial = 1 | <rational>. ;; monomial = 1 <monomial> ::= <single> | <single> <monomial>. <single> ::= <letter> ;; degree=1 | <letter> "^" <integer>. <letter> ::= "a" | ... | "z" | "A" | ... | "Z". <integer> ::= <digits> | "-" <digits>. <rational> ::= <integer> "/" <digits>. <digits> ::= <digit> | <digit> <digits>. <digit> ::= "0" | "1" | ... | "9".
polynomial, each terms are separated with "+" or "-" with left and right spaces
for convenience of parsing.
letter must be defined in
- Refactoring in more functional-way (avoid use of
while, and arrays).
- Transformation of Term/MonomialOrder to homogenize input of Buchberger.
- Optimization with suger.
- Not only
Qbut also calcurations on F_p.