groebner.rlg 27 KB

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