groebner.tex 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509
  1. \documentstyle[11pt,reduce]{article}
  2. \title{GROEBNER: A Package for Calculating Gr\"obner Bases, Version 3.0}
  3. \date{}
  4. \author{
  5. H. Melenk \& W. Neun \\[0.05in]
  6. Konrad--Zuse--Zentrum \\
  7. f\"ur Informationstechnik Berlin \\
  8. Takustrasse 7 \\
  9. D--14195 Berlin--Dahlem \\
  10. Germany \\[0.05in]
  11. Email: melenk@ZIB.DE \\[0.05in]
  12. and \\[0.05in]
  13. H.M. M\"oller \\[0.05in]
  14. FB Mathematik \\
  15. Universit\"at Dortmund \\
  16. D--44221 Dortmund \\
  17. Germany\\[0.05in]
  18. Email: Michael.Moeller@Math.Uni-Dortmund.DE}
  19. \begin{document}
  20. \maketitle
  21. \index{Gr\"obner Bases}
  22. Gr\"obner bases are a valuable tool for solving problems in
  23. connection with multivariate polynomials, such as solving systems of
  24. algebraic equations and analyzing polynomial ideals. For a definition
  25. of Gr\"obner bases, a survey of possible applications and further
  26. references, see~\cite{Buchberger:85}. Examples are given in \cite{Boege:86},
  27. in \cite{Buchberger:88} and also in the test file for this package.
  28. \index{Groebner package} \index{Buchberger's Algorithm}
  29. The Groebner package calculates Gr\"obner bases using the
  30. Buchberger algorithm. It can be used over a variety of different
  31. coefficient domains, and for different variable and term orderings.
  32. The current version of the package uses parts of the previous
  33. version, written by R. Gebauer, A.C. Hearn, H. Kredel and H. M.
  34. M\"oller. The algorithms implemented in the current version are
  35. documented in \cite{Faugere:89}, \cite{Gebauer:88},
  36. \cite{Kredel:88a} and \cite{Giovini:91}.
  37. \section{Background}
  38. \subsection{Variables, Domains and Polynomials}
  39. The various functions of the Groebner package manipulate
  40. equations and/or polynomials; equations are internally
  41. transformed into polynomials by forming the difference of
  42. left-hand side and right-hand side.
  43. All manipulations take place in a ring of polynomials in some
  44. variables $x1, \ldots , xn$ over a coefficient domain $d$:
  45. \[ d [x1,\ldots , xn], \]
  46. where $d$ is a field or at least a ring without zero divisors.
  47. The set of variables $x1,\ldots ,xn$ can be given explicitly by the
  48. user or it is extracted automatically from the
  49. input expressions.
  50. All REDUCE kernels can play the role of ``variables'' in this context;
  51. examples are
  52. %{\small
  53. \begin{verbatim}
  54. x y z22 sin(alpha) cos(alpha) c(1,2,3) c(1,3,2) farina4711
  55. \end{verbatim}
  56. %}
  57. The domain $d$ is the current REDUCE domain with those kernels
  58. adjoined that are not members of the list of variables. So the
  59. elements of $d$ may be complicated polynomials themselves over
  60. kernels not in the list of variables; if, however, the variables are
  61. extracted automatically from the input expressions, $d$ is identical
  62. with the current REDUCE domain. It is useful to regard kernels not
  63. being members of the list of variables as ``parameters'', e.g.
  64. \[
  65. \begin{array}{c}
  66. a * x + (a - b) * y**2 \;\mbox{ with ``variables''}\ \{x,y\} \\
  67. \mbox{and ``parameters'' $\;a\;$ and $\;b\;$}\;.
  68. \end{array}
  69. \]
  70. The current version of the Buchberger algorithm has two internal
  71. modes, a field mode and a ring mode. In the starting phase the
  72. algorithm analyzes the domain type; if it recognizes $d$ as being a
  73. ring it uses the ring mode, otherwise the field mode is needed.
  74. Normally field calculations occur only if all coefficients are numbers
  75. and if the current REDUCE domain is a field (e.g. rational numbers,
  76. modular numbers). In general, the ring mode is faster. When no specific
  77. REDUCE domain is selected, the ring mode is used, even if the input
  78. formulas contain fractional coefficients: they are multiplied by their
  79. common denominators so that they become integer polynomials.
  80. \subsection{Term Ordering} \par
  81. In the theory of Gr\"obner bases, the terms of polynomials are
  82. considered as ordered. Several order modes are available in
  83. the current package, including the basic modes:
  84. \index{lex ! term order} \index{gradlex ! term order}
  85. \index{revgradlex ! term order}
  86. \begin{center}
  87. $lex$, $gradlex$, $revgradlex$
  88. \end{center}
  89. All orderings are based on an ordering among the variables. For
  90. each pair of variables $(a,b)$ an order relation must be defined, e.g.
  91. ``$ a\gg b $''. The greater sign $\gg$ does not represent a numerical
  92. relation among the variables; it can be interpreted only in terms of
  93. formula representation: ``$a$'' will be placed in front of ``$b$'' or
  94. ``$a$'' is more complicated than ``$b$''.
  95. The sequence of variables constitutes this order base. So the notion
  96. of
  97. \[ \{x1,x2,x3\} \]
  98. as a list of variables at the same time means
  99. \[ x1 \gg x2 \gg x3 \]
  100. with respect to the term order.
  101. If terms (products of powers of variables) are compared with $lex$,
  102. that term is chosen which has a greater variable or a higher degree
  103. if the greatest variable is the first in both. With $gradlex$ the sum of
  104. all exponents (the total degree) is compared first, and if that does
  105. not lead to a decision, the $lex$ method is taken for the final decision.
  106. The $revgradlex$ method also compares the total degree first, but
  107. afterward it uses the $lex$ method in the reverse direction; this is the
  108. method originally used by Buchberger.
  109. \example \ with $\{x,y,z\}$: \index{Groebner package ! example}
  110. \[
  111. \begin{array}{rlll}
  112. \multicolumn{2}{l}{\hspace*{-1cm}\mbox{\bf lex:}}\\
  113. x * y **3 & \gg & y ** 48 & \mbox{(heavier variable)} \\
  114. x**4 * y**2 & \gg & x**3 * y**10 & \mbox{(higher degree in 1st
  115. variable)} \vspace*{2mm} \\
  116. \multicolumn{2}{l}{\hspace*{-1cm}\mbox{\bf gradlex:}} \\
  117. y**3 * z**4 & \gg & x**3 * y**3 & \mbox{(higher total degree)} \\
  118. x*z & \gg & y**2 & \mbox{(equal total degree)}
  119. \vspace*{2mm}\\
  120. \multicolumn{2}{l}{\hspace*{-1cm}\mbox{\bf
  121. revgradlex:}} \\
  122. y**3 * z**4 & \gg & x**3 * y**3 & \mbox{(higher total degree)} \\
  123. x*z & \ll & y**2 & \mbox{(equal total degree,} \\
  124. & & & \mbox{so reverse order of lex)}
  125. \end{array}
  126. \]
  127. The formal description of the term order modes is similar to
  128. \cite{Kredel:88}; this description regards only the exponents of a term,
  129. which are written as vectors of integers with $0$ for exponents of a
  130. variable which does not occur:
  131. \[
  132. \begin{array}{l}
  133. (e) = (e1,\ldots , en) \;\mbox{ representing }\; x1**e1 \ x2**e2 \cdots
  134. xn**en. \\
  135. \deg(e) \; \mbox{ is the sum over all elements of } \;(e) \\
  136. (e) \gg (l) \Longleftrightarrow (e)-(l)\gg (0) = (0,\ldots ,0)
  137. \end{array}
  138. \]
  139. \[
  140. \begin{array}{rll}
  141. \multicolumn{1}{l}{\hspace*{-.5cm}\mbox{\bf lex:}} \\
  142. (e) > lex > (0) & \Longrightarrow & e_k > 0 \mbox{ and } e_j =0
  143. \mbox{ for }\; j=1,\ldots , k-1\vspace*{2mm} \\
  144. \multicolumn{1}{l}{\hspace*{-.5cm}\mbox{\bf
  145. gradlex:}} \\
  146. (e) >gl> (0) & \Longrightarrow & \deg(e)>0 \mbox { or } (e) >lex>
  147. (0)\vspace*{2mm} \\
  148. \multicolumn{1}{l}{\hspace*{-.5cm}\mbox{\bf
  149. revgradlex:}}\\
  150. (e) >rgl> (0) & \Longrightarrow & \deg(e)>0 \mbox{ or }(e) <lex<
  151. (0)
  152. \end{array}
  153. \]
  154. Note that the $lex$ ordering is identical to the standard REDUCE
  155. kernel ordering, when $korder$ is set explicitly to the sequence of
  156. variables.
  157. \index{default ! term order}
  158. $Lex$ is the default term order mode in the Groebner package.
  159. It is beyond the scope of this manual to discuss the functionality of
  160. the term order modes. See \cite{Buchberger:88}.
  161. The list of variables is declared as an optional parameter of the
  162. $torder$ statement (see below). If this declaration is missing
  163. or if the empty list has been used, the variables are extracted from
  164. the expressions automatically and the REDUCE system order defines
  165. their sequence; this can be influenced by setting an explicit order
  166. via the $korder$ statement.
  167. The result of a Gr\"obner calculation is algebraically correct only
  168. with respect to the term order mode and the variable sequence
  169. which was in effect during the calculation. This is important if
  170. several calls to the Groebner package are done with the result of the
  171. first being the input of the second call. Therefore we recommend
  172. that you declare the variable list and the order mode explicitly.
  173. Once declared it remains valid until you enter a new $torder$
  174. statement. The operator $gvars$ helps you extract the variables
  175. from a given set of polynomials.
  176. \subsection{The Buchberger Algorithm}
  177. \index{Buchberger's Algorithm}
  178. The Buchberger algorithm of the package is based on {\sc
  179. Gebauer/M\"oller} \cite{Gebauer:88}.
  180. Extensions are documented in \cite{Melenk:88} and \cite{Giovini:91}.
  181. \section{Loading of the Package}
  182. The following command loads the package into
  183. REDUCE (this syntax may vary according to implementation):
  184. \begin{center}
  185. load groebner;
  186. \end{center}
  187. The package contains various operators, and switches for control
  188. over the reduction process. These are discussed in the following.
  189. \section{The Basic Operators}
  190. \subsection{Term Ordering Mode}
  191. \begin{description}
  192. \ttindex{torder}
  193. \item [{\it torder}]($vl$,$m$,$[p_1,p_2,\ldots]$);
  194. where $vl$ is a variable list (or the empty list if
  195. no variables are declared explicitly),
  196. $m$ is the name of a term ordering mode $lex$, $gradlex$,
  197. $revgradlex$ (or another implemented mode) and
  198. $[p_1,p_2,\ldots]$ are additional parameters for the
  199. term ordering mode (not needed for the basic modes).
  200. $torder$ sets variable set and the term ordering mode.
  201. The default mode is $lex$. The previous description is returned
  202. as a list with corresponding elements. Such a list can
  203. alternatively passed as sole argument to $torder$.
  204. If the variable list is empty or if the $torder$ declaration
  205. is omitted, the automatic variable extraction is activated.
  206. \ttindex{gvars}
  207. \item[{\it gvars}] ({\it\{exp$1$, exp$2$, $ \ldots$, exp$n$\}});
  208. where $\{exp1, exp2, \ldots , expn\}$ is a list of expressions or
  209. equations.
  210. $Gvars$ extracts from the expressions $\{exp1, exp2, \ldots , expn\}$
  211. the kernels, which can play the role of variables for a Gr\"obner
  212. calculation. This can be used e.g. in a $torder$ declaration.
  213. \end{description}
  214. \subsection{groebner: Calculation of a Gr\"obner Basis}
  215. \begin{description}
  216. \ttindex{groebner}
  217. \item[{\it groebner}] $\{exp1, exp2, \ldots , expm\}; $
  218. where $\{exp1, exp2, \ldots , expm\}$ is a list of
  219. expressions or equations.
  220. Groebner calculates the Gr\"obner basis of the given set of
  221. expressions with respect to the current $torder$ setting.
  222. The Gr\"obner basis $\{1\}$ means that the ideal generated by the
  223. input polynomials is the whole polynomial ring, or equivalently, that
  224. the input polynomials have no zeros in common.
  225. As a side effect, the sequence of variables is stored as a REDUCE list
  226. in the shared variable
  227. \ttindex{gvarslast}
  228. \begin{center}
  229. gvarslast .
  230. \end{center}
  231. This is important if the variables are reordered because of optimization:
  232. you must set them afterwards explicitly as the current variable sequence
  233. if you want to use the Gr\"obner basis in the sequel, e.g. for a
  234. $preduce$ call. A basis has the property ``Gr\"obner'' only with respect
  235. to the variable sequences which had been active during its computation.
  236. \end{description}
  237. \example \index{Groebner package ! example}
  238. \begin{verbatim}
  239. torder({},lex)$
  240. groebner{3*x**2*y + 2*x*y + y + 9*x**2 + 5*x - 3,
  241. 2*x**3*y - x*y - y + 6*x**3 - 2*x**2 - 3*x + 3,
  242. x**3*y + x**2*y + 3*x**3 + 2*x**2 };
  243. 2
  244. {8*x - 2*y + 5*y + 3,
  245. 3 2
  246. 2*y - 3*y - 16*y + 21}
  247. \end{verbatim}
  248. This example used the default system variable ordering, which was
  249. $\{x,y\}$. With the other variable ordering, a different basis results:
  250. \begin{verbatim}
  251. torder({y,x},lex)$
  252. groebner{3*x**2*y + 2*x*y + y + 9*x**2 + 5*x - 3,
  253. 2*x**3*y - x*y - y + 6*x**3 - 2*x**2 - 3*x + 3,
  254. x**3*y + x**2*y + 3*x**3 + 2*x**2 };
  255. 2
  256. {2*y + 2*x - 3*x - 6,
  257. 3 2
  258. 2*x - 5*x - 5*x}
  259. \end{verbatim}
  260. Another basis yet again results with a different term ordering:
  261. \begin{verbatim}
  262. torder({x,y},revgradlex)$
  263. groebner{3*x**2*y + 2*x*y + y + 9*x**2 + 5*x - 3,
  264. 2*x**3*y - x*y - y + 6*x**3 - 2*x**2 - 3*x + 3,
  265. x**3*y + x**2*y + 3*x**3 + 2*x**2 };
  266. 2
  267. {2*y - 5*y - 8*x - 3,
  268. y*x - y + x + 3,
  269. 2
  270. 2*x + 2*y - 3*x - 6}
  271. \end{verbatim}
  272. The operation of Groebner can be controlled by the following
  273. switches:
  274. \begin{description}
  275. \ttindex{groebopt}
  276. \item[groebopt] -- If set $on$, the sequence of variables is optimized
  277. with respect to execution speed; the algorithm involved is described
  278. in~\cite{Boege:86}; note that the final list of variables is available in
  279. \ttindex{gvarslast}
  280. $gvarslast$.
  281. An explicitly declared dependency supersedes the
  282. variable optimization. For example
  283. \begin{center}
  284. {\it depend} $a$, $x$, $y$;
  285. \end{center}
  286. guarantees that $a$ will be placed in front of $x$ and $y$. So
  287. $groebopt$ can be used even in cases where elimination of variables is
  288. desired.
  289. By default $groebopt$ is $off$, conserving the original variable
  290. sequence.
  291. \ttindex{groebfullreduction}
  292. \item[$groebfullreduction$] -- If set $off$, the reduction steps during
  293. the \linebreak[4] Groebner operation are limited to the pure head
  294. term reduction; subsequent terms are reduced otherwise.
  295. By default $groebfullreduction$ is on.
  296. \ttindex{gltbasis}
  297. \item[$gltbasis$] -- If set on, the leading terms of the result basis are
  298. extracted. They are collected in a basis of monomials, which is
  299. available as value of the global variable with the name $gltb$.
  300. \item[$glterms$] -- If $\{exp_1, \ldots , exp_m\} $ contain parameters
  301. (symbols which are not member of the variable list), the share variable
  302. {\tt $glterms$} contains a list of expression which during the
  303. calculation were assumed to be nonzero. A Gr\"obner basis
  304. is valid only under the assumption that all these expressions do
  305. not vanish.
  306. \end{description}
  307. The following switches control the print output of Groebner; by
  308. default all these switches are set $off$ and nothing is printed.
  309. \begin{description}
  310. \ttindex{groebstat}
  311. \item[$groebstat$] -- A summary of the computation is printed
  312. including the computing time, the number of intermediate
  313. $h$--polynomials and the counters for the hits of the criteria.
  314. \ttindex{trgroeb}
  315. \item[$trgroeb$] -- Includes $groebstat$ and the printing of the
  316. intermediate $h$-polynomials.
  317. \ttindex{trgroebs}
  318. \item[$trgroebs$] -- Includes $trgroeb$ and the printing of
  319. intermediate $s$--poly\-nomials.
  320. \ttindex{trgroeb1}
  321. \item[$trgroeb1$] -- The internal pairlist is printed when modified.
  322. \end{description}
  323. \subsection{$Gzerodim$?: Test of $\dim = 0$}
  324. \begin{description}
  325. \ttindex{gzerodim?}
  326. \item[{\it gzerodim}!?] $bas$ \\
  327. where {\it bas} is a Gr\"obner basis in the current setting.
  328. The result is {\it nil}, if {\it bas} is the
  329. basis of an ideal of polynomials with more than finitely many common zeros.
  330. If the ideal is zero dimensional, i. e. the polynomials of the ideal have only
  331. finitely many zeros in common, the result is an integer $k$ which is the number
  332. of these common zeros (counted with multiplicities).
  333. \end{description}
  334. \subsection{$Gdimension$, $gindependent$\_$sets$: compute dimension and
  335. independent variables}
  336. The following operators can be used to compute the dimension
  337. and the independent variable sets of an ideal which has the
  338. Gr\"obner basis {\it bas} with arbitrary term order:
  339. \begin{description}
  340. \ttindex{gdimension}\ttindex{gindependent\_sets}
  341. \ttindex{ideal dimension}\ttindex{independent sets}
  342. \item[$gdimension$]$bas$
  343. \item[$gindependent$\_$sets$]$bas$
  344. {\it Gindependent\_sets} computes the maximal
  345. left independent variable sets of the ideal, that are
  346. the variable sets which play the role of free parameters in the
  347. current ideal basis. Each set is a list which is a subset of the
  348. variable list. The result is a list of these sets. For an
  349. ideal with dimension zero the list is empty.
  350. {\it Gdimension} computes the dimension of the ideal,
  351. which is the maximum length of the independent sets.
  352. \end{description}
  353. The ``Kredel-Weispfenning" algorithm is used (see \cite{Kredel:88a},
  354. extended to general ordering in \cite{BeWei:93}.
  355. \subsection{Conversion of a Gr\"obner Basis}
  356. \subsubsection{$Glexconvert$: Conversion of an Arbitrary Gr\"obner Basis
  357. of a Zero Dimensional Ideal into a Lexical One}
  358. \begin{description}
  359. \ttindex{glexconvert}
  360. \item[{\it glexconvert}] $ \left(\{exp,\ldots , expm\} \left[,\{var1
  361. \ldots , varn\}\right]\left[,maxdeg=mx\right]\right.$ \\
  362. $\left.\left[,newvars=\{nv1, \ldots , nvk\}\right]\right) $ \\
  363. where $\{exp1, \ldots , expm\}$ is a Gr\"obner basis with
  364. $\{var1, \ldots , varn\}$ as variables in the current term order mode,
  365. $mx$ is an integer, and
  366. $\{nv1, \ldots , nvk\}$ is a subset of the basis variables.
  367. For this operator the source and target variable sets must be specified
  368. explicitly.
  369. \end{description}
  370. $Glexconvert$ converts a basis of a zero-dimensional ideal (finite number
  371. of isolated solutions) from arbitrary ordering into a basis under {\it
  372. lex} ordering. During the call of $glexconvert$ the original ordering of
  373. the input basis must be still active!
  374. $newvars$ defines the new variable sequence. If omitted, the
  375. original variable sequence is used. If only a subset of variables is
  376. specified here, the partial ideal basis is evaluated. For the
  377. calculation of a univariate polynomial, $new$\-$vars$ should be a list
  378. with one element.
  379. $maxdeg$ is an upper limit for the degrees. The algorithm stops with
  380. an error message, if this limit is reached.
  381. A warning occurs if the ideal is not zero dimensional.
  382. $Glexconvert$ is an implementation of the FLGM algorithm by
  383. \linebreak[4] {\sc Faug{\`e}re}, {\sc Gianni}, {\sc Lazard} and {\sc
  384. Mora} \cite{Faugere:89}. Often, the calculation of a Gr\"obner basis
  385. with a graded ordering and subsequent conversion to {\it lex} is
  386. faster than a direct {\it lex} calculation. Additionally, $glexconvert$
  387. can be used to transform a {\it lex} basis into one with different
  388. variable sequence, and it supports the calculation of a univariate
  389. polynomial. If the latter exists, the algorithm is even applicable in
  390. the non zero-dimensional case, if such a polynomial exists.
  391. If the polynomial does not exist, the algorithm computes until $maxdeg$
  392. has been reached.
  393. \begin{verbatim}
  394. torder({{w,p,z,t,s,b},gradlex)
  395. g := groebner { f1 := 45*p + 35*s -165*b -36,
  396. 35*p + 40*z + 25*t - 27*s, 15*w + 25*p*s +30*z -18*t
  397. -165*b**2, -9*w + 15*p*t + 20*z*s,
  398. w*p + 2*z*t - 11*b**3, 99*w - 11*s*b +3*b**2,
  399. b**2 + 33/50*b + 2673/10000};
  400. g := {60000*w + 9500*b + 3969,
  401. 1800*p - 3100*b - 1377,
  402. 18000*z + 24500*b + 10287,
  403. 750*t - 1850*b + 81,
  404. 200*s - 500*b - 9,
  405. 2
  406. 10000*b + 6600*b + 2673}
  407. glexconvert(g,{w,p,z,t,s,b},maxdeg=5,newvars={w});
  408. 2
  409. 100000000*w + 2780000*w + 416421
  410. glexconvert(g,{w,p,z,t,s,b},maxdeg=5,newvars={p});
  411. 2
  412. 6000*p - 2360*p + 3051
  413. \end{verbatim}
  414. \subsubsection{$groebner$\_$walk$: Conversion of a (General) Total Degree
  415. Basis into a Lex One}
  416. The algorithm $groebner\_walk$ converts a basis of an arbitrary polynomial
  417. system computed under $totak\ degree$ or under $weighted$ with a weight
  418. vector with only one element (e. g. $\{1,1,1,...\}$) to a $lex$ basis
  419. of the same variable sequence. The job is done by computing a sequence
  420. of Gr\"obner bases of correspondig monomial ideals, lifting the original
  421. system each time. The algorithm has been described (more generally) by
  422. \cite{AGK:961},\cite{AGK:962},\cite{AG:98},\cite{CKM:97}.
  423. $groebner\_walk$ should be only called, if the direct calculation of a
  424. $lex$ Gr\"obner base does not work. The computation of $groebner\_walk$
  425. includes some overhead (e. g. the computation including division).
  426. \begin{description}
  427. \ttindex{groebner\_walk}
  428. \item[{\it groebner\_walk}] $g$\\
  429. where $g$ is a polynomial ideal basis computed under $gradlex$ or under
  430. $weighted$ with a one--element, non zero weight vector with only one
  431. element, repeated for each variable. The result is a corresponding
  432. $lex$ basis (if that is computable), independet of the degree of the
  433. ideal (even for non zero degree ideals).
  434. The operator $torder$ has to be called before in order to define the
  435. variable sequence. Please do not call $groebner\_walk$ with $groebopt$
  436. $on$. The variable sequence will be taken unchanged from the call to
  437. $torder$. The variabe $gvarslast$ is not set!
  438. \end{description}
  439. \subsection{$Groebnerf$: Factorizing Gr\"obner Bases}
  440. \subsubsection{Background}
  441. If Gr\"obner bases are computed in order to solve systems of
  442. equations or to find the common roots of systems of polynomials,
  443. the factorizing version of the Buchberger algorithm can be used.
  444. The theoretical background is simple: if a polynomial $p$ can be
  445. represented as a product of two (or more) polynomials, e.g. $h= f*g$,
  446. then $h$ vanishes if and only if one of the factors vanishes. So if
  447. during the calculation of a Gr\"obner basis $h$ of the above form is
  448. detected, the whole problem can be split into two (or more)
  449. disjoint branches. Each of the branches is simpler than the complete
  450. problem; this saves computing time and space. The result of this
  451. type of computation is a list of (partial) Gr\"obner bases; the
  452. solution set of the original problem is the union of the solutions of
  453. the partial problems, ignoring the multiplicity of an individual
  454. solution. If a branch results in a basis $\{1\}$, then there is no
  455. common zero, i.e. no additional solution for the original problem,
  456. contributed by this branch.
  457. \subsubsection{$Groebnerf$ Call}
  458. \ttindex{Groebnerf}
  459. The syntax of groebnerf is the same as for groebner.
  460. \[ \mbox{\it groebnerf}(\{exp1, exp2, \ldots , expm\}
  461. [,\{\},\{nz1, \ldots nzk\}); \]
  462. where $\{exp1, exp2, \ldots , expm\} $ is a given list of expressions or
  463. equations, and $\{nz1, \ldots nzk\}$ is
  464. an optional list of polynomials known to be non-zero.
  465. $Groebnerf$ tries to separate polynomials into individual factors and
  466. to branch the computation in a recursive manner (factorization tree).
  467. The result is a list of partial Gr\"obner bases. If no factorization can
  468. be found or if all branches but one lead to the trivial basis $\{1\}$,
  469. the result has only one basis; nevertheless it is a list of lists of
  470. polynomials. If no solution is found, the result will be $\{\{1\}\}$.
  471. Multiplicities (one factor with a higher power, the same partial basis
  472. twice) are deleted as early as possible in order to speed up the
  473. calculation. The factorizing is controlled by some switches.
  474. As a side effect, the sequence of variables is stored as a REDUCE list in
  475. the shared variable
  476. \begin{center}
  477. gvarslast .
  478. \end{center}
  479. If $gltbasis$ is on, a corresponding list of leading term bases is
  480. also produced and is available in the variable $gltb$.
  481. The third parameter of $groebnerf$ allows one to declare some polynomials
  482. nonzero. If any of these is found in a branch of the calculation
  483. the branch is cancelled. This can be used to save a substantial amount
  484. of computing time. The second parameter must be included as an
  485. empty list if the third parameter is to be used.
  486. \begin{verbatim}
  487. torder({x,y},lex)$
  488. groebnerf { 3*x**2*y + 2*x*y + y + 9*x**2 + 5*x = 3,
  489. 2*x**3*y - x*y - y + 6*x**3 - 2*x**2 - 3*x = -3,
  490. x**3*y + x**2*y + 3*x**3 + 2*x**2 \};
  491. {{y - 3,x},
  492. 2
  493. {2*y + 2*x - 1,2*x - 5*x - 5}}
  494. \end{verbatim}
  495. It is obvious here that the solutions of the equations can be read
  496. off immediately.
  497. All switches from $groebner$ are valid for $groebnerf$ as well:
  498. \ttindex{groebopt} \ttindex{gltbasis}
  499. \ttindex{groebfullreduction} \ttindex{groebstat} \ttindex{trgroeb}
  500. \ttindex{trgroebs} \ttindex{trgroeb1}
  501. \begin{center}
  502. \begin{tabular}{l}
  503. $groebopt$ \\
  504. $gltbasis$ \\
  505. $groebfullreduction$ \\
  506. $groebstat$ \\
  507. $trgroeb$ \\
  508. $trgroebs$ \\
  509. $rgroeb1$
  510. \end{tabular}
  511. \end{center}
  512. \subsubsection*{Additional switches for $groebnerf$:}
  513. \begin{description}
  514. \ttindex{groebres}
  515. \item[$groebres$] -- If $on$, a resultant is calculated under certain
  516. circumstances (one bivariate $h$--polynomial is followed by another
  517. one). This sometimes shortens the calculation.
  518. By default $groebres$ is off.
  519. \ttindex{trgroebr}
  520. \item[$trgroebr$] -- All intermediate partial basis are printed when
  521. detected.
  522. By default $trgroebr$ is off.
  523. \end{description}
  524. {\it groebmonfac groebresmax groebrestriction} \\
  525. \hspace*{.5cm} These variables are described in the following
  526. paragraphs.
  527. \subsubsection{Suppression of Monomial Factors}
  528. The factorization in $groebnerf$ is controlled by the following
  529. \ttindex{groebmonfac}
  530. switches and variables. The variable $groebmonfac$ is connected to
  531. the handling of ``monomial factors''. A monomial factor is a product
  532. of variable powers occurring as a factor, e.g. $ x**2*y$ in $x**3*y -
  533. 2*x**2*y**2$. A monomial factor represents a solution of the type
  534. ``$ x = 0$ or $y = 0$'' with a certain multiplicity. With
  535. $groeb$\-$nerf$ \ttindex{groebnerf}
  536. the multiplicity of monomial factors is lowered to the value of the
  537. shared variable
  538. \ttindex{groebmonfac}
  539. \begin{center}
  540. $groebmonfac$
  541. \end{center}
  542. which by default is 1 (= monomial factors remain present, but their
  543. multiplicity is brought down). With
  544. \begin{center}
  545. $groebmonfac$ := 0
  546. \end{center}
  547. the monomial factors are suppressed completely.
  548. \subsubsection{Limitation on the Number of Results}
  549. The shared variable
  550. \ttindex{groebresmax}
  551. \begin{center}
  552. $groebresmax$
  553. \end{center}
  554. controls the number of partial results. Its default value is 300. If
  555. groebresmax partial results are calculated, the calculation is
  556. terminated.
  557. \subsubsection{Restriction of the Solution Space}
  558. In some applications only a subset of the complete solution set
  559. of a given set of equations is relevant, e.g. only
  560. nonnegative values or positive definite values for the variables.
  561. A significant amount of computing time can be saved if
  562. nonrelevant computation branches can be terminated early.
  563. Positivity: If a polynomial has no (strictly) positive zero, then
  564. every system containing it has no nonnegative or strictly positive
  565. solution. Therefore, the Buchberger algorithm tests the coefficients of
  566. the polynomials for equal sign if requested. For example, in $13*x +
  567. 15*y*z $ can be zero with real nonnegative values for $x, y$ and $z$
  568. only if $x=0$ and $y=0$ or $ z=0$; this is a sort of ``factorization by
  569. restriction''. A polynomial $13*x + 15*y*z + 20$ never can vanish
  570. with nonnegative real variable values.
  571. Zero point: If any polynomial in an ideal has an absolute term, the ideal
  572. cannot have the origin point as a common solution.
  573. By setting the shared variable
  574. \ttindex{groebrestriction}
  575. \begin{center} $groebrestriction$ \end{center}
  576. $Groebnerf$ is informed of the type of restriction the user wants to
  577. impose on the solutions:
  578. \begin{center}
  579. \begin{tabular}{l}
  580. {\it groebrestiction:=nonnegative;} \\
  581. \hspace*{+.5cm} only nonnegative real solutions are of
  582. interest\vspace*{4mm} \\
  583. {\it groebrestrictio:=positive;} \\
  584. \hspace*{+.5cm}only nonnegative and nonzero solutions are of
  585. interest\vspace*{4mm} \\
  586. {\it groebrestriction:=zeropoint;} \\
  587. \hspace*{+.5cm}only solution sets which contain the point
  588. $\{0,0,\ldots,0\}$ are or interest.
  589. \end{tabular}
  590. \end{center}
  591. If $groebnerf$ detects a polynomial which formally conflicts with the
  592. restriction, it either splits the calculation into separate branches, or,
  593. if a violation of the restriction is determined, it cancels the actual
  594. calculation branch.
  595. \subsection{$greduce$, $preduce$: Reduction of Polynomials}
  596. \subsubsection{Background} \label{groebner:background}
  597. Reduction of a polynomial ``p'' modulo a given sets of polynomials
  598. ``b'' is done by the reduction algorithm incorporated in the
  599. Buchberger algorithm. Informally it can be described for
  600. polynomials over a field as follows:
  601. \begin{center}
  602. \begin{tabular}{l}
  603. loop1: \hspace*{2mm}\% head term elimination \\
  604. \hspace*{-1cm} if there is one polynomial $b$ in $B$ such that the
  605. leading \\ term of $p$ is a multiple of the leading term of $P$ do \\
  606. $p := p - lt(p)/lt(b) * b$ (the leading term vanishes)\\
  607. \hspace*{-1cm} do this loop as long as possible; \\
  608. loop2: \hspace*{2mm} \% elimination of subsequent terms \\
  609. \hspace*{-1cm} for each term $s$ in $p$ do \\
  610. if there is one polynomial $b$ in $B$ such that $s$ is a\\
  611. multiple of the leading term of $p$ do \\
  612. $p := p - s/lt(b) * b$ (the term $s$ vanishes) \\
  613. \hspace*{-1cm}do this loop as long as possible;
  614. \end{tabular}
  615. \end{center}
  616. If the coefficients are taken from a ring without zero divisors we
  617. cannot divide by each possible number like in the field case. But
  618. using that in the field case, $c*p $ is reduced to $c*q $, if $ p $
  619. is reduced to $ q $, for arbitrary numbers $ c $, the reduction for
  620. the ring case uses the least $ c $ which makes the (field) reduction
  621. for $ c*p $ integer. The result of this reduction is returned as
  622. (ring) reduction of $ p $ eventually after removing the content, i.e.
  623. the greatest common divisor of the coefficients. The result of this
  624. type of reduction is also called a pseudo reduction of $ p $.
  625. \subsubsection{Reduction via Gr\"obner Basis Calculation}
  626. \ttindex{greduce}
  627. \[
  628. \mbox{\it greduce}(exp, \{exp1, exp2, \ldots , expm\}]);
  629. \]
  630. where {\it exp} is an expression, and $\{exp1, exp2,\ldots , expm\}$ is
  631. a list of any number of expressions or equations.
  632. $Greduce$ first converts the list of expressions $\{exp1, \ldots ,
  633. expn\}$ to a Gr\"obner basis, and then reduces the given expression
  634. modulo that basis. An error results if the list of expressions is
  635. inconsistent. The returned value is an expression representing the
  636. reduced polynomial. As a side effect, $greduce$ sets the variable {\it
  637. gvarslast} in the same manner as $groebner$ does.
  638. \subsubsection{Reduction with Respect to Arbitrary Polynomials}
  639. \ttindex{preduce}
  640. \[
  641. preduce(exp, \{exp1, exp2,\ldots , expm\});
  642. \]
  643. where $ expm $ is an expression, and $\{exp1, exp2, \ldots ,
  644. expm \}$ is a list of any number of expressions or equations.
  645. $Preduce$ reduces the given expression modulo the set $\{exp1,
  646. \ldots , expm\}$. If this set is a Gr\"obner basis, the obtained reduced
  647. expression is uniquely determined. If not, then it depends on the
  648. subsequence of the single reduction steps
  649. (see~\ref{groebner:background}). $Preduce$ does not check whether
  650. $\{exp1, exp2, \ldots , expm\}$ is a Gr\"obner basis in the actual
  651. order. Therefore, if the expressions are a Gr\"obner basis calculated
  652. earlier with a variable sequence given explicitly or modified by
  653. optimization, the proper variable sequence and term order must
  654. be activated first.
  655. \example ($Preduce$ called with a Gr\"obner basis):
  656. \begin{verbatim}
  657. torder({x,y},lex);
  658. gb:=groebner{3*x**2*y + 2*x*y + y + 9*x**2 + 5*x - 3,
  659. 2*x**3*y - x*y - y + 6*x**3 - 2*x**2 - 3*x + 3,
  660. x**3*y + x**2*y + 3*x**3 + 2*x**2}$
  661. preduce (5*y**2 + 2*x**2*y + 5/2*x*y + 3/2*y
  662. + 8*x**2 + 3/2*x - 9/2, gb);
  663. 2
  664. y
  665. \end{verbatim}
  666. \subsubsection{Reduction Tree}
  667. In some case not only are the results produced by $greduce$ and
  668. $preduce$ of interest, but the reduction process is of some value
  669. too. If the switch
  670. \ttindex{groebprot}
  671. \begin{center}
  672. $groebprot$
  673. \end{center}
  674. is set on, $groebner$, $greduce$ and $preduce$ produce as a side effect
  675. a trace of their work as a REDUCE list of equations in the shared variable
  676. \ttindex{groebprotfile}
  677. \begin{center}
  678. $groebprotfile$.
  679. \end{center}
  680. Its value is a list of equations with a variable ``candidate'' playing
  681. the role of the object to be reduced. The polynomials are cited as
  682. ``$poly1$'', ``$poly2$'', $\ldots\;$. If read as assignments, these equations
  683. form a program which leads from the reduction input to its result.
  684. Note that, due to the pseudo reduction with a ring as the coefficient
  685. domain, the input coefficients may be changed by global factors.
  686. \example \index{groebner package ! example}
  687. {\it on groebprot} \$ \\
  688. {\it preduce} $ (5*y**2 + 2*x**2*y + 5/2*x*y + 3/2*y + 8*x**2 $ \\
  689. \hspace*{+1cm} $+ 3/2*x - 9/2, gb);$
  690. \begin{verbatim}
  691. 2
  692. y
  693. \end{verbatim}
  694. {\it groebprotfile;}
  695. \begin{verbatim}
  696. 2 2 2
  697. {candidate=4*x *y + 16*x + 5*x*y + 3*x + 10*y + 3*y - 9,
  698. 2
  699. poly1=8*x - 2*y + 5*y + 3,
  700. 3 2
  701. poly2=2*y - 3*y - 16*y + 21,
  702. candidate=2*candidate,
  703. candidate= - x*y*poly1 + candidate,
  704. candidate= - 4*x*poly1 + candidate,
  705. candidate=4*candidate,
  706. 3
  707. candidate= - y *poly1 + candidate,
  708. candidate=2*candidate,
  709. 2
  710. candidate= - 3*y *poly1 + candidate,
  711. candidate=13*y*poly1 + candidate,
  712. candidate=candidate + 6*poly1,
  713. 2
  714. candidate= - 2*y *poly2 + candidate,
  715. candidate= - y*poly2 + candidate,
  716. candidate=candidate + 6*poly2}
  717. \end{verbatim}
  718. This means
  719. \begin{eqnarray*}
  720. \lefteqn{
  721. 16 (5 y^2 + 2 x^2 y + \frac{5}{2} x y + \frac{3}{2} y
  722. + 8 x^2+ \frac{3}{2} x - \frac{9}{2})=} \\ & &
  723. (-8 x y -32 x -2 y^3 -3 y^2 + 13 y + 6) \mbox{poly1} \\
  724. & & \; + (-2 y^2 -2 y + 6) \mbox{poly2 } \; + y^2.
  725. \end{eqnarray*}
  726. \subsection{Tracing with $groebnert$ and $preducet$}
  727. Given a set of polynomials $\{f_1,\ldots ,f_k\}$ and their Gr\"obner
  728. basis $\{g_1,\ldots ,g_l\}$, it is well known that there are matrices of
  729. polynomials $C_{ij}$ and $D_{ji}$ such that
  730. \[
  731. f_i = \displaystyle{\sum\limits_j} C_{ij} g_j \;\mbox{ and } g_j =
  732. \displaystyle{\sum\limits_i} D_{ji} f_i
  733. \]
  734. and these relations are needed explicitly sometimes.
  735. In {\sc Buchberger} \cite{Buchberger:85}, such cases are described in the
  736. context of linear polynomial equations. The standard technique for
  737. computing the above formulae is to perform
  738. Gr\"obner reductions, keeping track of the
  739. computation in terms of the input data. In the current package such
  740. calculations are performed with (an internally hidden) cofactor
  741. technique: the user has to assign unique names to the input
  742. expressions and the arithmetic combinations are done with the
  743. expressions and with their names simultaneously. So the result is
  744. accompanied by an expression which relates it algebraically to the
  745. input values.
  746. \ttindex{groebnert} \ttindex{preducet}
  747. There are two complementary operators with this feature: $groebnert$
  748. and $preducet$; functionally they correspond to $groebner$ and $preduce$.
  749. However, the sets of expressions here {\it {\bf must be}} equations
  750. with unique single identifiers on their left side and the {\it lhs} are
  751. interpreted as names of the expressions. Their results are
  752. sets of equations ($groebnert$) or equations ($preducet$), where
  753. a {\it lhs} is the computed value, while the {\it rhs} is its equivalent
  754. in terms of the input names.
  755. \example \index{groebner package ! example}
  756. We calculate the Gr\"obner basis for an ellipse (named ``$p1$'' ) and a
  757. line (named ``$p2$'' ); $p2$ is member of the basis immediately and so
  758. the corresponding first result element is of a very simple form; the
  759. second member is a combination of $p1$ and $p2$ as shown on the
  760. {\it rhs} of this equation:
  761. \begin{verbatim}
  762. gb1:=groebnert {p1=2*x**2+4*y**2-100,p2=2*x-y+1};
  763. gb1 := {2*x - y + 1=p2,
  764. 2
  765. 9*y - 2*y - 199= - 2*x*p2 - y*p2 + 2*p1 + p2}
  766. \end{verbatim}
  767. \example \index{groebner package ! example}
  768. We want to reduce the polynomial \verb+ x**2+ {\it wrt}
  769. the above Gr\"obner basis and need knowledge about the reduction
  770. formula. We therefore extract the basis polynomials from $gb1$,
  771. assign unique names to them (here $g1$, $g2$) and call $preducet$.
  772. The polynomial to be reduced here is introduced with the name $Q$,
  773. which then appears on the {\it rhs} of the result. If the name for the
  774. polynomial is omitted, its formal value is used on the right side too.
  775. \begin{verbatim}
  776. gb2 := for k := 1:length gb1 collect
  777. mkid(g,k) = lhs part(gb1,k)$
  778. preducet (q=x**2,gb2);
  779. - 16*y + 208= - 18*x*g1 - 9*y*g1 + 36*q + 9*g1 - g2
  780. \end{verbatim}
  781. This output means
  782. \[
  783. x^2 = (\frac{1}{2} x + \frac{1}{4} y - \frac{1}{4}) g1
  784. + \frac{1}{36} g2 + (-\frac{4}{9} y + \frac{52}{9}).
  785. \]
  786. \example \index{groebner package ! example}
  787. If we reduce a polynomial which is member of the ideal, we
  788. consequently get a result with {\it lhs} zero:
  789. \begin{verbatim}
  790. preducet(q=2*x**2+4*y**2-100,gb2);
  791. 0= - 2*x*g1 - y*g1 + 2*q + g1 - g2
  792. \end{verbatim}
  793. This means
  794. \[ q = ( x + \frac{1}{2} y - \frac{1}{2}) g1 + \frac{1}{2} g2.
  795. \]
  796. With these operators the matrices $C_{ij}$ and $D_{ji}$ are available
  797. implicitly, $D_{ji}$ as side effect of $groebnert$T, $c_{ij}$ by {\it calls}
  798. of $preducet$ of $f_i$ {\it wrt} $\{g_j\}$. The latter by definition will
  799. have the {\it lhs} zero and a {\it rhs} with linear $f_i$.
  800. If $\{1\}$ is the Gr\"obner basis, the $groebnert$ calculation gives
  801. a ``proof'', showing, how $1$ can be computed as combination of the
  802. input polynomials.
  803. \paragraph{Remark:} Compared to the non-tracing algorithms, these
  804. operators are much more time consuming. So they are applicable
  805. only on small sized problems.
  806. \subsection{Gr\"obner Bases for Modules}
  807. Given a polynomial ring, e.g. $r=z[x_1 \cdots x_k]$ and
  808. an integer $n>1$: the vectors with $n$ elements of $r$
  809. form a $module$ under vector addition (= componentwise addition)
  810. and multiplication with elements of $r$. For a submodule
  811. given by a finite basis a Gr\"obner basis
  812. can be computed, and the facilities of the Groebner package
  813. can be used except the operators $groebnerf$ and $groesolve$.
  814. The vectors are encoded using auxiliary variables which represent
  815. the unit vectors in the module. E.g. using ${v_1,v_2,v_3}$ the
  816. module element $[x_1^2,0,x_1-x_2]$ is represented as
  817. $x_1^2 v_1 + x_1 v_3 - x_2 v_3$. The use of ${v_1,v_2,v_3}$
  818. as unit vectors is set up by assigning the set of auxiliary variables
  819. to the share variable $gmodule$, e.g.
  820. \begin{verbatim}
  821. gmodule := {v1,v2,v3};
  822. \end{verbatim}
  823. After this declaration all monomials built from these variables
  824. are considered as an algebraically independent basis of a vector
  825. space. However, you had best use them only linearly. Once $gmodule$
  826. has been set, the auxiliary variables automatically will be
  827. added to the end of each variable list (if they are not yet
  828. member there).
  829. Example:
  830. \begin{verbatim}
  831. torder({x,y,v1,v2,v3},lex)$
  832. gmodule := {v1,v2,v3}$
  833. g:=groebner{x^2*v1 + y*v2,x*y*v1 - v3,2y*v1 + y*v3};
  834. 2
  835. g := {x *v1 + y*v2,
  836. 2
  837. x*v3 + y *v2,
  838. 3
  839. y *v2 - 2*v3,
  840. 2*y*v1 + y*v3}
  841. preduce((x+y)^3*v1,g);
  842. 1 3 2
  843. - x*y*v2 - ---*y *v3 - 3*y *v2 + 3*y*v3
  844. 2
  845. \end{verbatim}
  846. In many cases a total degree oriented term order will be adequate
  847. for computations in modules, e.g. for all cases where the
  848. submodule membership is investigated. However, arranging
  849. the auxiliary variables in an elimination oriented term order
  850. can give interesting results. E.g.
  851. \begin{verbatim}
  852. p1:=(x-1)*(x^2-x+3)$ p2:=(x-1)*(x^2+x-5)$
  853. gmodule := {v1,v2,v3};
  854. torder({v1,x,v2,v3},lex)$
  855. gb:=groebner {p1*v1+v2,p2*v1+v3};
  856. gb := {30*v1*x - 30*v1 + x*v2 - x*v3 + 5*v2 - 3*v3,
  857. 2 2
  858. x *v2 - x *v3 + x*v2 + x*v3 - 5*v2 - 3*v3}
  859. g:=coeffn(first gb,v1,1);
  860. g := 30*(x - 1)
  861. c1:=coeffn(first gb,v2,1);
  862. c1 := x + 5
  863. c2:=coeffn(first gb,v3,1);
  864. c2 := - x - 3
  865. c1*p1 + c2*p2;
  866. 30*(x - 1)
  867. \end{verbatim}
  868. Here two polynomials
  869. are entered as vectors $[p_1,1,0]$ and $[p_2,0,1]$. Using a term
  870. ordering such that the first dimension ranges highest and the
  871. other components lowest, a classical cofactor computation is
  872. executed just as in the extended Euclidean algorithm.
  873. Consequently the leading polynomial in the resulting
  874. basis shows the greatest common divisor of $p_1$ and $p_2$,
  875. found as a coefficient of $v_1$ while the coefficients
  876. of $v_2$ and $v_3$ are the cofactors $c_1$ and $c_2$ of the polynomials
  877. $p_1$ and $p_2$ with the relation $gcd(p_1,p_2) = c_1p_1 + c_2p_2$.
  878. \subsection{Additional Orderings}
  879. Besides the basic orderings, there are ordering options that are used for
  880. special purposes.
  881. \subsubsection{Separating the Variables into Groups }
  882. \index{grouped ordering}
  883. It is often desirable to separate variables
  884. and formal parameters in a system of polynomials.
  885. This can be done with a {\it lex} Gr\"obner
  886. basis. That however may be hard to compute as it does more
  887. separation than necessary. The following orderings group the
  888. variables into two (or more) sets, where inside each set a classical
  889. ordering acts, while the sets are handled via their total degrees,
  890. which are compared in elimination style. So the Gr\"obner basis will
  891. eliminate the members of the first set, if algebraically possible.
  892. {\it torder} here gets an additional parameter which describe the
  893. grouping \ttindex{torder}
  894. \begin{center}{\it
  895. \begin{tabular}{l}
  896. torder ($vl$,$gradlexgradlex$, $n$) \\
  897. torder ($vl$,$gradlexrevgradlex$,$n$) \\
  898. torder ($vl$,$lexgradlex$, $n$) \\
  899. torder ($vl$,$lexrevgradlex$, $n$)
  900. \end{tabular}}
  901. \end{center}
  902. Here the integer $n$ is the number of variables in the first group
  903. and the names combine the local ordering for the first and second
  904. group, e.g.
  905. \begin{center}
  906. \begin{tabular}{llll}
  907. \multicolumn{4}{l}{{\it lexgradlex}, 3 for $\{x_1,x_2,x_3,x_4,x_5\}$:} \\
  908. \multicolumn{4}{l}{$x_1^{i_1}\ldots x_5^{i_5} \gg x_1^{j_1}\ldots
  909. x_5^{j_5}$} \\
  910. if & & & $(i_1,i_2,i_3) \gg_{lex}(j_1,j_2,j_3)$ \\
  911. & or & & $(i_1,i_2,i_3) = (j_1,j_2,j_3)$ \\
  912. & & and & $(i_4,i_5) \gg_{gradlex}(j_4,j_5)$
  913. \end{tabular}
  914. \end{center}
  915. Note that in the second place there is no {\it lex} ordering available;
  916. that would not make sense.
  917. \subsubsection{Weighted Ordering}
  918. \ttindex{torder} \index{weighted ordering}
  919. The statement
  920. \begin{center}
  921. \begin{tabular}{cl}
  922. {\it torder} &($vl$,weighted, $\{n_1,n_2,n_3 \ldots$\}) ; \\
  923. \end{tabular}
  924. \end{center}
  925. establishes a graduated ordering, where the exponents are first
  926. multiplied by the given weights. If there are less weight values than
  927. variables, the weight 1 is added automatically. If the weighted
  928. degree calculation is not decidable, a $lex$ comparison follows.
  929. \subsubsection{Graded Ordering}
  930. \ttindex{torder} \index{graded ordering}
  931. The statement
  932. \begin{center}
  933. \begin{tabular}{cl}
  934. {\it torder} &($vl$,graded, $\{n_1,n_2,n_3 \ldots\}$,$order_2$) ; \\
  935. \end{tabular}
  936. \end{center}
  937. establishes a graduated ordering, where the exponents are first
  938. multiplied by the given weights. If there are less weight values than
  939. variables, the weight 1 is added automatically. If the weighted
  940. degree calculation is not decidable, the term order $order_2$ specified
  941. in the following argument(s) is used. The ordering $graded$ is designed
  942. primarily for use with the operator $dd\_groebner$.
  943. \subsubsection{Matrix Ordering}
  944. \ttindex{torder} \index{matrix ordering}
  945. The statement
  946. \begin{center}
  947. \begin{tabular}{cl}
  948. {\it torder} &($vl$,matrix, $m$) ; \\
  949. \end{tabular}
  950. \end{center}
  951. where $m$ is a matrix with integer elements and row length which
  952. corresponds to the variable number. The exponents of each monomial
  953. form a vector; two monomials are compared by multiplying their
  954. exponent vectors first with $m$ and comparing the resulting vector
  955. lexicographically. E.g. the unit matrix establishes the classical
  956. $lex$ term order mode, a matrix with a first row of ones followed
  957. by the rows of a unit matrix corresponds to the $gradlex$ ordering.
  958. The matrix $m$ must have at least as many rows as columns; a non--square
  959. matrix contains redundant rows. The matrix must have full rank, and
  960. the top non--zero element of each column must be positive.
  961. The generality of the matrix based term order has its price: the
  962. computing time spent in the term sorting is significantly higher
  963. than with the specialized term orders. To overcome this problem,
  964. you can compile a matrix term order
  965. if your REDUCE is equipped with a LISP compiler; the
  966. compilation reduces the computing time overhead significantly.
  967. If you set the switch $comp$ on, any new order matrix is compiled
  968. when any operator of the Groebner package accesses it for the
  969. first time. Alternatively you can compile a matrix explicitly
  970. \begin{verbatim}
  971. torder_compile(<n>,<m>);
  972. \end{verbatim}
  973. where $<n>$ is a name (an identifier) and $<m>$ is a term order matrix.
  974. $torder\_compile$ transforms the matrix into a LISP program, which
  975. is compiled by the LISP compiler when $comp$ is on or when you
  976. generate a fast loadable module. Later you can activate the new term
  977. order by using the name $<n>$ in a $torder$ statement as term ordering
  978. mode.
  979. \subsection{Gr\"obner Bases for Graded Homogeneous Systems}
  980. For a homogeneous system of polynomials under a term order
  981. {\it graded}, {\it gradlex}, {\it revgradlex} or {\it weighted}
  982. a Gr\"obner Base can be computed with limiting the grade
  983. of the intermediate $s$--polynomials:
  984. \begin{description}
  985. \ttindex{dd\_groebner}
  986. \item [{\it dd\_groebner}]($d1$,$d2$,$\{p_1,p_2,\ldots\}$);
  987. \end{description}
  988. where $d1$ is a non--negative integer and $d2$ is an integer
  989. $>$ $d1$ or ``infinity". A pair of polynomials is considered
  990. only if the grade of the lcm of their head terms is between
  991. $d1$ and $d2$. See \cite{BeWei:93} for the mathematical background.
  992. For the term orders {\it graded} or {\it weighted} the (first) weight
  993. vector is used for the grade computation. Otherwise the total
  994. degree of a term is used.
  995. \section{Ideal Decomposition \& Equation System Solving}
  996. Based on the elementary Gr\"obner operations, the groebner package offers
  997. additional operators, which allow the decomposition of an ideal or of a
  998. system of equations down to the individual solutions.
  999. \subsection{Solutions Based on Lex Type Gr\"obner Bases}
  1000. \subsubsection{Groesolve: Solution of a Set of Polynomial Equations}
  1001. \ttindex{groesolve} \ttindex{groebnerf}
  1002. The $groesolve$ operator incorporates a macro algorithm;
  1003. lexical Gr\"obner bases are computed by $groebnerf$ and decomposed
  1004. into simpler ones by ideal decomposition techniques; if algebraically
  1005. possible, the problem is reduced to univariate polynomials which are
  1006. solved by $solve$; if $rounded$ is on, numerical approximations are
  1007. computed for the roots of the univariate polynomials.
  1008. \[
  1009. groesolve(\{exp1, exp2, \ldots , expm\}[,\{var1, var2, \ldots ,
  1010. varn\}]); \]
  1011. where $\{exp1, exp2,\ldots , expm\}$ is a list of any number of
  1012. expressions or equations, $\{var1, var2, \ldots , varn\}$ is an
  1013. optional list of variables.
  1014. The result is a set of subsets. The subsets contain the solutions of the
  1015. polynomial equations. If there are only finitely many solutions,
  1016. then each subset is a set of expressions of triangular type
  1017. $\{exp1, exp2,\ldots , expn\},$ where $exp1$ depends only on
  1018. $var1,$ $exp2$ depends only on $var1$ and $var2$ etc. until $expn$ which
  1019. depends on $var1,\ldots,varn.$ This allows a successive determination of
  1020. the solution components. If there are infinitely many solutions,
  1021. some subsets consist in less than $n$ expressions. By considering some
  1022. of the variables as ``free parameters'', these subsets are usually
  1023. again of triangular type.
  1024. \example (intersections of a line with a circle):
  1025. \index{groebner package ! example}
  1026. \[ groesolve(\{x**2 - y**2 - a, p*x+q*y+s\},\{x,y\}); \]
  1027. \begin{verbatim}
  1028. 2 2 2 2 2
  1029. {{x=(sqrt( - a*p + a*q + s )*q - p*s)/(p - q ),
  1030. 2 2 2 2 2
  1031. y= - (sqrt( - a*p + a*q + s )*p - q*s)/(p - q )},
  1032. 2 2 2 2 2
  1033. {x= - (sqrt( - a*p + a*q + s )*q + p*s)/(p - q ),
  1034. 2 2 2 2 2
  1035. y=(sqrt( - a*p + a*q + s )*p + q*s)/(p - q )}}
  1036. \end{verbatim}
  1037. \subsubsection{$Groepostproc$: Postprocessing of a Gr\"obner Basis}
  1038. \ttindex{groepostproc}
  1039. In many cases, it is difficult to do the general Gr\"obner processing.
  1040. If a Gr\"obner basis with a {\it lex} ordering is calculated already (e.g.,
  1041. by very individual parameter settings), the solutions can be derived
  1042. from it by a call to $groepostproc$. $Groesolve$ is functionally
  1043. equivalent to a call to $groebnerf$ and subsequent calls to
  1044. $groepostproc$ for each partial basis.
  1045. \[
  1046. groepostproc(\{exp1, exp2, \ldots , expm\}[,\{var1, var2, \ldots ,
  1047. varn\}]);
  1048. \]
  1049. where $\{exp1, exp2, \ldots , expm\}$ is a list of any number of
  1050. expressions, \linebreak[4] $\{var1, var2, \ldots ,$ $ varn\}$ is an
  1051. optional list of variables. The expressions must be a {\it lex} Gr\"obner
  1052. basis with the given variables; the ordering must be still active.
  1053. The result is the same as with $groesolve$.
  1054. \begin{verbatim}
  1055. groepostproc({x3**2 + x3 + x2 - 1,
  1056. x2*x3 + x1*x3 + x3 + x1*x2 + x1 + 2,
  1057. x2**2 + 2*x2 - 1,
  1058. x1**2 - 2},{x3,x2,x1});
  1059. {{x3= - sqrt(2),
  1060. x2=sqrt(2) - 1,
  1061. x1=sqrt(2)},
  1062. {x3=sqrt(2),
  1063. x2= - (sqrt(2) + 1),
  1064. x1= - sqrt(2)},
  1065. sqrt(4*sqrt(2) + 9) - 1
  1066. {x3=-------------------------,
  1067. 2
  1068. x2= - (sqrt(2) + 1),
  1069. x1=sqrt(2)},
  1070. - (sqrt(4*sqrt(2) + 9) + 1)
  1071. {x3=------------------------------,
  1072. 2
  1073. x2= - (sqrt(2) + 1),
  1074. x1=sqrt(2)},
  1075. sqrt( - 4*sqrt(2) + 9) - 1
  1076. {x3=----------------------------,
  1077. 2
  1078. x2=sqrt(2) - 1,
  1079. x1= - sqrt(2)},
  1080. - (sqrt( - 4*sqrt(2) + 9) + 1)
  1081. {x3=---------------------------------,
  1082. 2
  1083. x2=sqrt(2) - 1,
  1084. x1= - sqrt(2)}}
  1085. \end{verbatim}
  1086. \subsubsection{Idealquotient: Quotient of an Ideal and an Expression}
  1087. \ttindex{idealquotient} \index{ideal quotient}
  1088. Let $I$ be an ideal and $f$ be a polynomial in the same
  1089. variables. Then the algebraic quotient is defined by
  1090. \[
  1091. I:f = \{ p \;| \; p * f \;\mbox{ member of }\; I\}\;.
  1092. \]
  1093. The ideal quotient $I:f$ contains $I$ and is obviously part of the
  1094. whole polynomial ring, i.e. contained in $\{1\}$. The case $I:f =
  1095. \{1\}$ is equivalent to $f$ being a member of $I$. The other extremal
  1096. case, $I:f=I$, occurs, when $f$ does not vanish at any general zero of $I$.
  1097. The explanation of the notion ``general zero'' introduced by van der
  1098. Waerden, however, is beyond the aim of this manual. The operation
  1099. of $groesolve$/$groepostproc$ is based on nested ideal quotient
  1100. calculations.
  1101. If $I$ is given by a basis and $f$ is given as an expression, the
  1102. quotient can be calculated by
  1103. \[
  1104. idealquotient (\{exp1, \ldots , expm\}, exp); \]
  1105. where $\{exp1, exp2, \ldots , expm\}$ is a list of any number of
  1106. expressions or equations, {\it exp} is a single expression or equation.
  1107. $Idealquotient$ calculates the algebraic quotient of the ideal $I$
  1108. with the basis $\{exp1, exp2, \ldots , expm\}$ and {\it exp} with
  1109. respect to the variables given or extracted. $\{exp1, exp2, \ldots ,
  1110. expm\}$ is not necessarily a Gr\"obner basis.
  1111. The result is the Gr\"obner basis of the quotient.
  1112. \subsection{Operators for Gr\"obner Bases in all Term Orderings}
  1113. \index{Hilbert polynomial}
  1114. In some cases where no Gr\"obner
  1115. basis with lexical ordering can be calculated, a calculation with a total
  1116. degree ordering is still possible. Then the Hilbert polynomial gives
  1117. information about the dimension of the solutions space and for finite
  1118. sets of solutions univariate polynomials can be calculated. The solutions
  1119. of the equation system then is contained in the cross product of all
  1120. solutions of all univariate polynomials.
  1121. \subsubsection{Hilbertpolynomial: Hilbert Polynomial of an Ideal}
  1122. \ttindex{hilbertpolynomial}
  1123. This algorithm was contributed by {\sc Joachim Hollman}, Royal
  1124. Institute of Technology, Stockholm (private communication).
  1125. \[
  1126. hilbertpolynomial (\{exp1, \ldots , expm\})\;;
  1127. \]
  1128. where $\{exp1, \ldots , expm\}$ is a list of any number of expressions
  1129. or equations.
  1130. $Hilertpolynomial$ calculates the Hilbert polynomial of the ideal
  1131. with basis $\{exp1, \ldots , expm\}$ with respect to the
  1132. variables given or extracted provided the given term ordering is
  1133. compatible with the degree, such as the $gradlex$- or $revgradlex$-ordering.
  1134. The term ordering of the basis
  1135. must be active and $\{exp1, \ldots$, $ expm\}$ should be a
  1136. Gr\"obner basis with respect to this ordering. The Hilbert polynomial
  1137. gives information about the cardinality of solutions of the system
  1138. $\{exp1, \ldots , expm\}$: if the Hilbert polynomial is an
  1139. integer, the system has only a discrete set of solutions and the
  1140. polynomial is identical with the number of solutions counted with
  1141. their multiplicities. Otherwise the degree of the Hilbert
  1142. polynomial is the dimension of the solution space.
  1143. If the Hilbert polynomial is not a constant, it is constructed with the
  1144. variable ``x'' regardless of whether $x$ is member of
  1145. $\{var1, \ldots , varn\}$ or not. The value of this polynomial at
  1146. sufficiently large numbers ``x'' is the difference
  1147. of the dimension of the linear vector space of all polynomials of degree
  1148. $ \leq x $ minus the dimension of the subspace of all polynomials of
  1149. degree $\leq x $ which belong also to the ideal.
  1150. \paragraph{Remark:} The number of zeros in an ideal and the
  1151. Hilbert polynomial depend only on the leading terms of the
  1152. Gr\"obner basis. So if a subsequent Hilbert calculation is planned, the
  1153. Gr\"obner calculation should be performed with $on$ $gltbasis$ and
  1154. the value of $gltb$ (or its elements in a $groebnerf$ context) should be
  1155. given to $hilbertpolynomial$. In this manner, a lot of computing time can be
  1156. saved in the case of large bases.
  1157. \section{Calculations ``by Hand''}
  1158. The following operators support explicit calculations with
  1159. polynomials in a distributive representation at the REDUCE top level.
  1160. So they allow one to do Gr\"obner type evaluations stepwise by
  1161. separate calls. Note that the normal REDUCE arithmetic can be used
  1162. for arithmetic combinations of monomials and polynomials.
  1163. \subsection{Representing Polynomials in Distributive Form}
  1164. \ttindex{gsort}
  1165. \[
  1166. gsort (p);
  1167. \]
  1168. where $p$ is a polynomial or a list of polynomials.
  1169. If $p$ is a single polynomial, the result is a reordered version of $p$
  1170. in the distributive representation according to the variables and the
  1171. current term order mode; if $p$ is a list, its members are converted
  1172. into distributive representation and the result is the list sorted by
  1173. the term ordering of the leading terms; zero polynomials are
  1174. eliminated from the result.
  1175. \begin{verbatim}
  1176. torder({alpha,beta,gamma},lex);
  1177. dip := gsort(gamma*(alpha-1)**2*(beta+1)**2);
  1178. 2 2 2
  1179. dip := alpha *beta *gamma + 2*alpha *beta*gamma
  1180. 2 2
  1181. + alpha *gamma - 2*alpha*beta *gamma - 4*alpha*beta*gamma
  1182. 2
  1183. - 2*alpha*gamma + beta *gamma + 2*beta*gamma + gamma
  1184. \end{verbatim}
  1185. \subsection{Splitting of a Polynomial into Leading Term and Reductum}
  1186. \ttindex{gsplit}
  1187. \[ gsplit (p); \]
  1188. where $p$ is a polynomial.
  1189. $Gsplit$ converts the polynomial $p$ into distributive representation
  1190. and splits it into leading monomial and reductum. The result is a list
  1191. with two elements, the leading monomial and the reductum.
  1192. \begin{verbatim}
  1193. gslit(dip);
  1194. 2 2
  1195. {alpha *beta *gamma,
  1196. 2 2 2
  1197. 2*alpha *beta*gamma + alpha *gamma - 2*alpha*beta *gamma
  1198. 2
  1199. - 4*alpha*beta*gamma - 2*alpha*gamma + beta *gamma
  1200. + 2*beta*gamma + gamma}
  1201. \end{verbatim}
  1202. \subsection{Calculation of Buchberger's S-polynomial}
  1203. \ttindex{gspoly}
  1204. \[ gspoly (p1,p2); \]
  1205. where $p1$ and $p2$ are polynomials.
  1206. $Gspoly$ calculates the $s$-polynomial from $p1$ and $p2$;
  1207. Example for a complete calculation (taken from {\sc Davenport et al.}
  1208. \cite{Davenport:88a}):
  1209. \begin{verbatim}
  1210. torder({x,y,z},lex)$
  1211. g1 := x**3*y*z - x*z**2;
  1212. g2 := x*y**2*z - x*y*z;
  1213. g3 := x**2*y**2 - z;$
  1214. % first S-polynomial
  1215. g4 := gspoly(g2,g3);$
  1216. 2 2
  1217. g4 := x *y*z - z
  1218. % next S-polynomial
  1219. p := gspoly(g2,g4); $
  1220. 2 2
  1221. p := x *y*z - y*z
  1222. % and reducing, here only by g4
  1223. g5 := preduce(p,{g4});
  1224. 2 2
  1225. g5 := - y*z + z
  1226. % last S-polynomial}
  1227. g6 := gspoly(g4,g5);
  1228. 2 2 3
  1229. g6 := x *z - z
  1230. % and the final basis sorted descending
  1231. gsort{g2,g3,g4,g5,g6};
  1232. 2 2
  1233. {x *y - z,
  1234. 2 2
  1235. x *y*z - z ,
  1236. 2 2 3
  1237. x *z - z ,
  1238. 2
  1239. x*y *z - x*y*z,
  1240. 2 2
  1241. - y*z + z }
  1242. \end{verbatim}
  1243. \bibliography{groebner}
  1244. \bibliographystyle{plain}
  1245. \end{document}