GROEBNER.LOG 24 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  1. REDUCE 3.6, 15-Jul-95, patched to 6 Mar 96 ...
  2. % Examples of use of Groebner code.
  3. % In the Examples 1 - 3 the polynomial ring for the ideal operations
  4. % (variable sequence, term order mode) is defined globally in advance.
  5. % Example 1, Linz 85.
  6. torder ({q1,q2,q3,q4,q5,q6},lex)$
  7. groebner {q1,
  8. q2**2 + q3**2 + q4**2,
  9. q4*q3*q2,
  10. q3**2*q2**2 + q4**2*q2**2 + q4**2*q3**2,
  11. q6**2 + 1/3*q5**2,
  12. q6**3 - q5**2*q6,
  13. 2*q2**2*q6 - q3**2*q6 - q4**2*q6 + q3**2*q5 - q4**2*q5,
  14. 2*q2**2*q6**2 - q3**2*q6**2 - q4**2*q6**2 - 2*q3**2*q5*q6
  15. + 2*q4**2*q5*q6 - 2/3*q2**2*q5**2 + 1/3*q3**2*q5**2
  16. + 1/3*q4**2*q5**2,
  17. - q3**2*q2**2*q6 - q4**2*q2**2*q6 + 2*q4**2*q3**2*q6 -
  18. q3**2*q2**2*q5 + q4**2*q2**2*q5,
  19. - q3**2*q2**2*q6**2 - q4**2*q2**2*q6**2 + 2*q4**2*q3**2*q6**2
  20. + 2*q3**2*q2**2*q5*q6 - 2*q4**2*q2**2*q5*q6 + 1/3*q3**2*q2**2
  21. *q5**2 + 1/3*q4**2*q2**2*q5**2 - 2/3*q4**2*q3**2*q5**2,
  22. - 3*q3**2*q2**4*q5*q6**2 + 3*q4**2*q2**4*q5*q6**2
  23. + 3*q3**4*q2**2*q5*q6**2 - 3*q4**4*q2**2*q5*q6**2
  24. - 3*q4**2*q3**4*q5*q6**2 + 3*q4**4*q3**2*q5*q6**2
  25. + 1/3*q3**2*q2**4*q5**3 - 1/3*q4**2*q2**4*q5**3
  26. - 1/3*q3**4*q2**2*q5**3 + 1/3*q4**4*q2**2*q5**3 + 1/3*q4**2
  27. *q3**4*q5**3 - 1/3*q4**4*q3**2*q5**3};
  28. {q1,
  29. 2 2 2
  30. q2 + q3 + q4 ,
  31. q2*q3*q4,
  32. 4
  33. q2*q4 *q6,
  34. 3 3
  35. q2*q4 *q5 + 3*q2*q4 *q6,
  36. 3 2
  37. q2*q4 *q6 ,
  38. 4 2 2 4
  39. q3 + q3 *q4 + q4 ,
  40. 3 3
  41. q3 *q4 + q3*q4 ,
  42. 2 2
  43. q3 *q4 *q6,
  44. 2 2 2 2
  45. q3 *q5 - 3*q3 *q6 - q4 *q5 - 3*q4 *q6,
  46. 2 2 2 2
  47. q3 *q6 + q4 *q6 ,
  48. 4
  49. q3*q4 *q6,
  50. 3
  51. q3*q4 *q5,
  52. 3 2
  53. q3*q4 *q6 ,
  54. 5
  55. q4 ,
  56. 4 4
  57. q4 *q5 + q4 *q6,
  58. 4 2
  59. q4 *q6 ,
  60. 2 2 2
  61. q4 *q5*q6 - q4 *q6 ,
  62. 2 2
  63. q5 + 3*q6 ,
  64. 3
  65. q6 }
  66. % Example 2. (Little) Trinks problem with 7 polynomials in 6 variables.
  67. trinkspolys := {45*p + 35*s - 165*b - 36,
  68. 35*p + 40*z + 25*t - 27*s,
  69. 15*w + 25*p*s + 30*z - 18*t - 165*b**2,
  70. - 9*w + 15*p*t + 20*z*s,
  71. w*p + 2*z*t - 11*b**3,
  72. 99*w - 11*s*b + 3*b**2,
  73. b**2 + 33/50*b + 2673/10000}$
  74. trinksvars := {w,p,z,t,s,b}$
  75. torder(trinksvars,lex)$
  76. groebner trinkspolys;
  77. {60000*w + 9500*b + 3969,
  78. 1800*p - 3100*b - 1377,
  79. 18000*z + 24500*b + 10287,
  80. 750*t - 1850*b + 81,
  81. 200*s - 500*b - 9,
  82. 2
  83. 10000*b + 6600*b + 2673}
  84. groesolve ws;
  85. 3*(4*sqrt(11)*i - 11)
  86. {{b=-----------------------,
  87. 100
  88. 62*sqrt(11)*i + 59
  89. p=--------------------,
  90. 300
  91. 3*(5*sqrt(11)*i - 13)
  92. s=-----------------------,
  93. 50
  94. 148*sqrt(11)*i - 461
  95. t=----------------------,
  96. 500
  97. - 190*sqrt(11)*i - 139
  98. w=-------------------------,
  99. 10000
  100. - 490*sqrt(11)*i - 367
  101. z=-------------------------},
  102. 3000
  103. 3*( - 4*sqrt(11)*i - 11)
  104. {b=--------------------------,
  105. 100
  106. - 62*sqrt(11)*i + 59
  107. p=-----------------------,
  108. 300
  109. 3*( - 5*sqrt(11)*i - 13)
  110. s=--------------------------,
  111. 50
  112. - 148*sqrt(11)*i - 461
  113. t=-------------------------,
  114. 500
  115. 190*sqrt(11)*i - 139
  116. w=----------------------,
  117. 10000
  118. 490*sqrt(11)*i - 367
  119. z=----------------------}}
  120. 3000
  121. % Example 3. Hairer, Runge-Kutta 1, 6 polynomials 8 variables.
  122. torder({c2,c3,b3,b2,b1,a21,a32,a31},lex);
  123. {{w,p,z,t,s,b},lex}
  124. groebnerf {c2 - a21,
  125. c3 - a31 - a32,
  126. b1 + b2 + b3 - 1,
  127. b2*c2 + b3*c3 - 1/2,
  128. b2*c2**2 + b3*c3**2 - 1/3,
  129. b3*a32*c2 - 1/6};
  130. {{c2 - a21,
  131. c3 - a32 - a31,
  132. b3 + b2 + b1 - 1,
  133. 2 2 2 2 2 2
  134. 96*b2*b1*a31 - 96*b2*a31 + 96*b2*a31 - 32*b2 - 72*b1 *a32 *a31 - 48*b1 *a32
  135. 2 2 2 2 3 2
  136. - 144*b1 *a32*a31 - 144*b1 *a32*a31 - 72*b1 *a31 + 198*b1*a32 *a31
  137. 2 2 3
  138. + 60*b1*a32 + 396*b1*a32*a31 + 72*b1*a32*a31 - 144*b1*a32 + 198*b1*a31
  139. 2 2
  140. - 108*b1*a31 - 24*b1*a31 - 81*a21*a32*a31 + 54*a21*a32 - 126*a32 *a31
  141. 2 2 3 2
  142. - 12*a32 - 252*a32*a31 + 126*a32*a31 + 36*a32 - 126*a31 + 162*a31
  143. - 30*a31 - 12,
  144. 2 2
  145. 8*b2*a21 - 8*b2*a31 + 6*b1*a32 + 12*b1*a32*a31 + 4*b1*a32 + 6*b1*a31
  146. 2 2
  147. - 4*b1*a31 - 9*a21*a32 - 6*a32 - 12*a32*a31 + 8*a32 - 6*a31 + 10*a31 - 2,
  148. 2 2
  149. 8*b2*a32 + 6*b1*a32 + 12*b1*a32*a31 + 12*b1*a32 + 6*b1*a31 + 4*b1*a31
  150. 2 2
  151. - 9*a21*a32 - 6*a32 - 12*a32*a31 - 6*a31 + 2*a31 + 2,
  152. 2 2 2
  153. 12*b1*a21*a32 - 6*b1*a32 - 12*b1*a32*a31 - 6*b1*a31 - 3*a21*a32 + 6*a32
  154. 2
  155. + 12*a32*a31 - 6*a32 + 6*a31 - 6*a31 + 2,
  156. 2 2
  157. 4*b1*a21*a31 + 2*b1*a32 + 4*b1*a32*a31 + 2*b1*a31 - 3*a21*a32 - 4*a21*a31
  158. 2 2
  159. + 2*a21 - 2*a32 - 4*a32*a31 + 4*a32 - 2*a31 + 4*a31 - 2,
  160. 3 2 2 3 2
  161. 6*b1*a32 + 18*b1*a32 *a31 + 18*b1*a32*a31 + 6*b1*a31 - 9*a21*a32
  162. 3 2 2 2
  163. - 9*a21*a32*a31 + 6*a21*a32 - 6*a32 - 18*a32 *a31 + 12*a32 - 18*a32*a31
  164. 3 2
  165. + 18*a32*a31 - 6*a32 - 6*a31 + 6*a31 - 2*a31,
  166. 2 2 2
  167. 3*a21 *a32 - 3*a21*a32 - a21*a31 + a32 + 2*a32*a31 + a31 }}
  168. % The examples 4 and 5 use automatic variable extraction.
  169. % Example 4.
  170. torder gradlex$
  171. g4 :=
  172. groebner({b + e + f - 1,
  173. c + d + 2*e - 3,
  174. b + d + 2*f - 1,
  175. a - b - c - d - e - f,
  176. d*e*a**2 - 1569/31250*b*c**3,
  177. c*f - 587/15625*b*d});
  178. 5
  179. g4 := {144534461790680056924571742971580442350868*f
  180. 4
  181. - 644899801559202566371326081182412388593750*f
  182. 2
  183. - 5642454222593591361522253644740080176968509*e*f
  184. 3
  185. + 1026970650200404602876625225711718032483739*f
  186. + 60671378319336814425425106786936647125250*e*f
  187. 2
  188. + 12135463840178290842421221291430776956948795*f
  189. + 82342665293813692270756265387326300721851*e
  190. - 6546572608747272255841866021042619274525791*f
  191. - 455593441982762135422235490670177670637,
  192. 3 4
  193. 8282838608877853969*e*f - 2667985333760708531*f
  194. 2 3
  195. - 315490964385538173*e*f - 8319462093247392142*f - 25594942638053*e*f
  196. 2
  197. + 318993777538462620*f + 33851175608089*e + 34163367871142*f
  198. - 8568425233089,
  199. 2 2
  200. 587*e - 46875*e*f + 15038*f - 587*e + 47462*f,
  201. a + 2*e - 4,
  202. b + e + f - 1,
  203. c + 3*e - f - 3,
  204. d - e + f}
  205. hilbertpolynomial g4;
  206. 8
  207. glexconvert(g4,gvarslast,newvars={e},maxdeg=8);
  208. 8 7
  209. {8724935291855297898986*e - 82886885272625330040367*e
  210. 6 5
  211. + 304980377204235125220384*e - 524915947547338451201596*e
  212. 4 3
  213. + 362375013966993813907616*e + 52719473339686639067952*e
  214. 2
  215. - 154986762992209058701440*e + 27347344067139574366944*e + 430203494102932512
  216. }
  217. % Example 5.
  218. torder({u0,u2,u3,u1},lex)$
  219. groesolve({u0**2 - u0 + 2*u1**2 + 2*u2**2 + 2*u3**2,
  220. 2*u0*u1 + 2*u1*u2 + 2*u2*u3 - u1,
  221. 2*u0*u2 + u1**2 + 2*u1*u3 - u2,
  222. u0 + 2*u1 + 2*u2 + 2*u3 - 1},
  223. {u0,u2,u3,u1});
  224. 1 1
  225. {{u3=---,u0=---,u2=0,u1=0},
  226. 3 3
  227. {u3=0,u0=1,u2=0,u1=0},
  228. {u3
  229. 5 4 3 2
  230. - 35588322*u1 + 7102080*u1 + 3462372*u1 - 522672*u1 - 98665*u1 + 11905
  231. =-----------------------------------------------------------------------------
  232. 10987
  233. ,
  234. 5 4 3 2
  235. u0=(85796172*u1 - 47481552*u1 - 10265256*u1 + 4828462*u1 + 414200*u1
  236. - 24707)/164805,
  237. 5 4 3 2
  238. u2=(490926744*u1 - 82790424*u1 - 46802952*u1 + 5425849*u1 + 1108070*u1
  239. - 83819)/164805,
  240. 6 5 4 3 2
  241. u1=root_of(24948*u1_ - 8424*u1_ - 1908*u1_ + 736*u1_ + 24*u1_ - 18*u1_
  242. + 1,u1_,tag_1)}}
  243. % Example 6. (Big) Trinks problem with 6 polynomials in 6 variables.
  244. torder(trinksvars,lex)$
  245. btbas :=
  246. groebner {45*p + 35*s - 165*b - 36,
  247. 35*p + 40*z + 25*t - 27*s,
  248. 15*w + 25*p*s + 30*z - 18*t - 165*b**2,
  249. -9*w + 15*p*t + 20*z*s,
  250. w*p + 2*z*t - 11*b**3,
  251. 99*w - 11*b*s + 3*b**2};
  252. btbas := {17766149161458472422166115589155691471353640232570952361584640*w
  253. 9
  254. + 3032932981764169411024286535087872715152793150994240000000000000*b
  255. + 11886822444254795859791802829918904596379497649520730600000000000
  256. 8
  257. *b +
  258. 7
  259. 18842475008351431516615767365088235858572104823839818660000000000*b +
  260. 6
  261. 18478618789454571665641479626067848900525899492180377333740000000*b
  262. 5
  263. + 11752365113063961011548983119538614396423298749092231098450400000*b
  264. 4
  265. + 5110161259755495688253057699488605142801193206234091633443430000*b
  266. 3
  267. + 1496961750963944475883560598484727796781670457510019079125319720*b
  268. 2
  269. + 288690575257721822668492218552623049380964882774348400629792405*b
  270. + 36675221781192845731725910375461662443650512572339688148737880*b
  271. + 1576363174251807401047861085627012261518448811764870474808048,
  272. 1079293561558602199646591522041208256884733644128685355966266880*p +
  273. 9
  274. 3268477702530974927415861070452491173139572636038856000000000000000*b
  275. +
  276. 12885633343818230635528913313274512975854362843839764665000000000000
  277. 8
  278. *b +
  279. 20548731096300848092222002490748474767709483225818633322500000000000
  280. 7
  281. *b +
  282. 20182049540868333737979937480097593847242554499522522583343500000000
  283. 6
  284. *b +
  285. 12840592651209104850152262711039251760751322701157046861979660000000
  286. 5
  287. *b +
  288. 4
  289. 5569707184558884260455460870514004047533638259197462099687709750000*b
  290. + 1626104523905067336734029117969017435050069455164231436772691393000
  291. 3
  292. *b +
  293. 2
  294. 317837165064133808425156860561547977935248864650364953213370433325*b
  295. + 38814916107963233682867824475195786374043607759221055124383464600*b
  296. + 1271557117681971715777755868970298734422034654142333039426477936,
  297. 79947671226563125899747520151200611621091381046569285627130880*z -
  298. 9
  299. 207000360174268878618253807286221414267374039050881600000000000000*b
  300. - 816930976846005632807581869594187232031930825060787069000000000000
  301. 8
  302. *b -
  303. 7
  304. 1304191848597021137419209873493260430019068809677834324500000000000*b
  305. - 1281648951757969533154633755921969360988365079018184794999100000000
  306. 6
  307. *b -
  308. 5
  309. 816111850476984294981540451378918253659030380648143145999676000000*b
  310. - 354123157925898223808181474698490366723104830470028121053590350000
  311. 4
  312. *b -
  313. 3
  314. 103524414072393919562685172085266423030522292688870620316927889800*b
  315. 2
  316. - 20314259597530323830287024948271996904872237353588201428371308545*b
  317. - 2537917907646239051588678539186026277776904294491429226344955896*b
  318. - 101754994043218022355542895254001231074817584410141704072917808,
  319. 53964678077930109982329576102060412844236682206434267798313344*t -
  320. 9
  321. 232158787821822686686268803096828213303267879649894080000000000000*b
  322. - 914339994087255788035842922803409884324637299732580010200000000000
  323. 8
  324. *b -
  325. 7
  326. 1456553024942306848445635398194494646048613632462079804220000000000*b
  327. - 1429773468085320579659912540829309032262384742022357855878580000000
  328. 6
  329. *b -
  330. 5
  331. 908944691139155009098308941935669674404431611232759364790656800000*b
  332. - 394123305458525780887811122985868682566594060374758630590008810000
  333. 4
  334. *b -
  335. 3
  336. 114919063563435384108358931167592408356874179358918284670595993240*b
  337. 2
  338. - 22376181506466478409426169614162075694852682500804198791108921475*b
  339. - 2945714266609139709176973289117451707834537151497408879223183208*b
  340. - 127343046946408668687682889109197718306724189305639804298381200,
  341. 23984301367968937769924256045360183486327414313970785688139264*s -
  342. 9
  343. 93385077215170712211881744870071176375416361029681600000000000000*b -
  344. 8
  345. 368160952680520875300826094664986085024410366966850419000000000000*b
  346. - 587106602751452802634914356878527850505985235023389523500000000000
  347. 7
  348. *b -
  349. 6
  350. 576629986881952392513712499431359824206930128557786359524100000000*b
  351. - 366874075748831567147207506029692907450037791461629910342276000000
  352. 5
  353. *b -
  354. 4
  355. 159134490987396693155870310586114401358103950262784631419648850000*b
  356. 3
  357. - 46460129254430495335257974799114783858573413004692326764934039800*b
  358. 2
  359. - 9081061858975251669290196016044227941007110418581855806096298095*b
  360. - 1222066452390803097568723620648006189979646603457892421797898376*b
  361. - 60999770483681527871286545331521866855137759127008037834271184,
  362. 10 9
  363. 43808000000000000000*b + 189995300000000000000*b
  364. 8 7
  365. + 343169730200000000000*b + 377900184178000000000*b
  366. 6 5
  367. + 277427432368460000000*b + 141636786601439800000*b
  368. 4 3
  369. + 50921375336016834000*b + 12792266529459977340*b
  370. 2
  371. + 2215667232541084905*b + 237653554658069880*b + 8984801833047216}
  372. % The above system has dimension zero. Therefore its Hilbert polynomial
  373. % is a constant which is the number of zero points (including complex
  374. % zeros and multipliticities);
  375. hilbertpolynomial ws;
  376. 10
  377. % Example of Groebner with numerical postprocessing.
  378. on rounded;
  379. groesolve(trinkspolys,trinksvars);
  380. {{b= - 0.397994974843*i - 0.33,
  381. p= - 0.685435790007*i + 0.196666666667,
  382. s= - 0.994987437107*i - 0.78,
  383. t= - 0.981720937945*i - 0.922,
  384. w=0.0630158710168*i - 0.0139,
  385. z=0.541715382425*i - 0.122333333333},
  386. {b=0.397994974843*i - 0.33,
  387. p=0.685435790007*i + 0.196666666667,
  388. s=0.994987437107*i - 0.78,
  389. t=0.981720937945*i - 0.922,
  390. w= - 0.0630158710168*i - 0.0139,
  391. z= - 0.541715382425*i - 0.122333333333}}
  392. off rounded;
  393. % Additional groebner operators.
  394. % Reduce one polynomial wrt the basis of big Trinks. The result 0
  395. % is a proof for the ideal membership of the polynomial.
  396. torder(trinksvars,lex)$
  397. preduce(45*p + 35*s - 165*b - 36,btbas);
  398. 0
  399. % The following examples show how to work with the distributive
  400. % form of polynomials.
  401. torder({u0,u1,u2,u3},gradlex)$
  402. gsplit(2*u0*u2 + u1**2 + 2*u1*u3 - u2,{u0,u1,u2,u3});
  403. 2
  404. {2*u0*u2,u1 + 2*u1*u3 - u2}
  405. torder(trinksvars,lex)$
  406. gsort trinkspolys;
  407. 3
  408. {w*p + 2*z*t - 11*b ,
  409. 2
  410. 99*w - 11*s*b + 3*b ,
  411. - 9*w + 15*p*t + 20*z*s,
  412. 2
  413. 15*w + 25*p*s + 30*z - 18*t - 165*b ,
  414. 35*p + 40*z + 25*t - 27*s,
  415. 45*p + 35*s - 165*b - 36,
  416. 2 33 2673
  417. b + ----*b + -------}
  418. 50 10000
  419. gspoly(first trinkspolys, second trinkspolys);
  420. 360*z + 225*t - 488*s + 1155*b + 252
  421. gvars trinkspolys;
  422. {w,p,z,t,s,b}
  423. % Tagged basis and reduction trace. A tagged basis is a basis where
  424. % each polynomial is equated to a linear combination of the input
  425. % set. A tagged reduction shows how the result is computed by using
  426. % the basis polynomials.
  427. % First example for tagged polynomials: show how a polynomial is
  428. % represented as linear combination of the basis polynomials.
  429. % First I set up an environment for the computation.
  430. torder(trinksvars,lex)$
  431. % Then I compute an ordinary Groebner basis.
  432. bas := groebner trinkspolys$
  433. % Next I assign a tag to each basis polynomial.
  434. taggedbas := for i:= 1:length bas collect
  435. mkid(p,i) = part(bas,i);
  436. taggedbas := {p1=9500*b + 60000*w + 3969,
  437. p2= - 3100*b + 1800*p - 1377,
  438. p3=24500*b + 18000*z + 10287,
  439. p4= - 1850*b + 750*t + 81,
  440. p5= - 500*b + 200*s - 9,
  441. 2
  442. p6=10000*b + 6600*b + 2673}
  443. % And finally I reduce a (tagged) polynomial wrt the tagged basis.
  444. preducet(new=w*p + 2*z*t - 11*b**3,taggedbas);
  445. 3 2
  446. 857375000000*p*w + 1714750000000*t*z + 2376000000000000*w + 471517200000000*w
  447. 2
  448. + 31190862780000*w + 687758524299=992750000*b *p1 - 6270000000*b*p1*w
  449. 2
  450. - 414760500*b*p1 + 857375000000*new + 39600000000*p1*w + 5239080000*p1*w
  451. + 173282571*p1
  452. % Second example for tagged polynomials: representing a Groebner basis
  453. % as a combination of the input polynomials, here in a simple geometric
  454. % problem.
  455. torder({x,y},lex)$
  456. groebnert {circle=x**2 + y**2 - r**2,line = a*x + b*y};
  457. { - a*x - b*y= - line,
  458. 2 2 2 2 2 2
  459. (a + b )*y - a *r =a *circle - a*line*x + b*line*y}
  460. % In the third example I enter two polynomials that have no common zero.
  461. % Consequently the basis is {1}. The tagged computation gives me a proof
  462. % for the inconsistency of the system which is independent of the
  463. % Groebner formalism.
  464. groebnert {circle1=x**2 + y**2 - 10,circle2=x**2 + y**2 - 2};
  465. - circle1 + circle2
  466. {1=----------------------}
  467. 8
  468. % Solve a special elimination task by using a blockwise elimination
  469. % order defined by a matrix. The equation set goes back to A.M.H.
  470. % Levelt (Nijmegen). The question is whether there is a member in the
  471. % ideal which depends only on two variables. Here we select x4 and y1.
  472. % The existence of such a polynomial proves that the system has exactly
  473. % one degree of freedom.
  474. % The first two rows of the term order matrix define the groupwise
  475. % elimination. The remaining lines define a secondary local
  476. % lexicographical behavior which is needed to construct an admissible
  477. % ordering.
  478. f1 := y1^2 + z1^2 -1;
  479. 2 2
  480. f1 := y1 + z1 - 1
  481. f2 := x2^2 + y2^2 + z2^2 -1;
  482. 2 2 2
  483. f2 := x2 + y2 + z2 - 1
  484. f3 := x3^2 + y3^2 + z3^2 -1;
  485. 2 2 2
  486. f3 := x3 + y3 + z3 - 1
  487. f4 := x4^2 + z4^2 -1;
  488. 2 2
  489. f4 := x4 + z4 - 1
  490. f5 := y1*y2 + z1*z2;
  491. f5 := y1*y2 + z1*z2
  492. f6 := x2*x3 + y2*y3 + z2*z3;
  493. f6 := x2*x3 + y2*y3 + z2*z3
  494. f7 := x3*x4 + z3*z4;
  495. f7 := x3*x4 + z3*z4
  496. f8 := x2 + x3 + x4 + 1;
  497. f8 := x2 + x3 + x4 + 1
  498. f9 := y1 + y2 + y3 - 1;
  499. f9 := y1 + y2 + y3 - 1
  500. f10:= z1 + z2 + z3 + z4;
  501. f10 := z1 + z2 + z3 + z4
  502. eqns := {f1,f2,f3,f4,f5,f6,f7,f8,f9,f10}$
  503. vars := {x2,x3,y2,y3,z1,z2,z3,z4,x4,y1}$
  504. torder(vars,matrix,
  505. mat(
  506. (1,1,1,1,1,1,1,1,0,0),
  507. (0,0,0,0,0,0,0,0,1,1),
  508. (1,0,0,0,0,0,0,0,0,0),
  509. (0,1,0,0,0,0,0,0,0,0),
  510. (0,0,1,0,0,0,0,0,0,0),
  511. (0,0,0,1,0,0,0,0,0,0),
  512. (0,0,0,0,1,0,0,0,0,0),
  513. (0,0,0,0,0,1,0,0,0,0),
  514. (0,0,0,0,0,0,1,0,0,0),
  515. (0,0,0,0,0,0,0,0,1,0)));
  516. {{x,y},lex}
  517. first reverse groebner(eqns,vars);
  518. 2 2 2 2
  519. x4 *y1 - 2*x4 + 2*x4*y1 - 2*x4 - 2*y1 + 2*y1
  520. % For a faster execution we convert the matrix into a
  521. % proper machine code routine. This step can be taken only
  522. % if there is access to a compiler.
  523. on comp;
  524. torder_compile(levelt,mat(
  525. (1,1,1,1,1,1,1,1,0,0),
  526. (0,0,0,0,0,0,0,0,1,1),
  527. (1,0,0,0,0,0,0,0,0,0),
  528. (0,1,0,0,0,0,0,0,0,0),
  529. (0,0,1,0,0,0,0,0,0,0),
  530. (0,0,0,1,0,0,0,0,0,0),
  531. (0,0,0,0,1,0,0,0,0,0),
  532. (0,0,0,0,0,1,0,0,0,0),
  533. (0,0,0,0,0,0,1,0,0,0),
  534. (0,0,0,0,0,0,0,0,1,0)));
  535. +++ levelt compiled, 304 + 16 bytes
  536. levelt
  537. torder(vars,levelt)$
  538. first reverse groebner(eqns,vars);
  539. 2 2 2 2
  540. x4 *y1 - 2*x4 + 2*x4*y1 - 2*x4 - 2*y1 + 2*y1
  541. % For a homogeneous polynomial set we compute a graded Groebner
  542. % basis with grade limits. We use the graded term order with lex
  543. % as following order. As the grade vector has no zeros, this ordering
  544. % is functionally equivalent to a weighted ordering.
  545. torder({x,y,z},graded,{1,1,2},lex);
  546. {{x2,x3,y2,y3,z1,z2,z3,z4,x4,y1},levelt}
  547. dd_groebner(0,10,{x^10*y + y*z^5, x*y^12 + y*z^6});
  548. 12 6 10 5
  549. {x*y + y*z ,x *y + y*z }
  550. dd_groebner(0,50,{x^10*y + y*z^5, x*y^12 + y*z^6});
  551. 7 18 34 5
  552. {x *y*z - y *z ,
  553. 8 12 23 5
  554. x *y*z + y *z ,
  555. 9 6 12 5
  556. x *y*z - y *z ,
  557. 12 6
  558. x*y + y*z ,
  559. 10 5
  560. x *y + y*z }
  561. dd_groebner(0,infinity,{x^10*y + y*z^5, x*y^12 + y*z^6});
  562. 111 5 60
  563. {y *z + y*z ,
  564. 54 100 5
  565. x*y*z - y *z ,
  566. 2 48 89 5
  567. x *y*z + y *z ,
  568. 3 42 78 5
  569. x *y*z - y *z ,
  570. 4 36 67 5
  571. x *y*z + y *z ,
  572. 5 30 56 5
  573. x *y*z - y *z ,
  574. 6 24 45 5
  575. x *y*z + y *z ,
  576. 7 18 34 5
  577. x *y*z - y *z ,
  578. 8 12 23 5
  579. x *y*z + y *z ,
  580. 9 6 12 5
  581. x *y*z - y *z ,
  582. 12 6
  583. x*y + y*z ,
  584. 10 5
  585. x *y + y*z }
  586. end;
  587. (TIME: groebner 12249 13339)