groebner.tex 60 KB

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