cali.rlg 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085
  1. Wed Jan 27 22:49:30 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: % Author H.-G. Graebe | Univ. Leipzig | Version 28.6.1995
  6. % graebe@informatik.uni-leipzig.de
  7. COMMENT
  8. This is an example session demonstrating and testing the facilities
  9. offered by the commutative algebra package CALI.
  10. END COMMENT;
  11. algebraic;
  12. on echo;
  13. off nat;
  14. % To make it easier to compare differing output.
  15. showtime;
  16. Time: 0 ms
  17. comment
  18. ####################################
  19. ### ###
  20. ### Introductory Examples ###
  21. ### ###
  22. ####################################
  23. end comment;
  24. % Example 1 : Generating ideals of affine and projective points.
  25. vars:={t,x,y,z};
  26. vars := {t,x,y,z}$
  27. setring(vars,degreeorder vars,revlex);
  28. {{t,x,y,z},{{1,1,1,1}},revlex,{1,1,1,1}}$
  29. mm:=mat((1,1,1,1),(3,2,3,1),(2,1,3,2));
  30. mm := mat((1,1,1,1),(3,2,3,1),(2,1,3,2))$
  31. % The ideal with zero set at the point in A^4 with coordinates
  32. % equal to the row vectors of mm :
  33. setideal(m1,affine_points mm);
  34. {z**2 - 3*z + 2,
  35. y**2 - 4*y + 3,
  36. t - y + z - 1,
  37. 2*x - y + 2*z - 3,
  38. y*z - y - 3*z + 3}$
  39. % All parameters are as they should be :
  40. dim m1;
  41. 0$
  42. degree m1;
  43. 3$
  44. groebfactor m1;
  45. {{z - 2,y - 3,t - 2,x - 1},
  46. {z - 1,t - 3,y - 3,x - 2},
  47. {z - 1,t - 1,y - 1,x - 1}}$
  48. resolve m1$
  49. bettinumbers m1;
  50. {1,5,9,7,2}$
  51. % The ideal with zero set at the point in P^3 with homogeneous
  52. % coordinates equal to the row vectors of mm :
  53. setideal(m2,proj_points mm);
  54. {2*y**2 - 2*x*z - 7*y*z + 7*z**2,
  55. 3*t - 2*x - 2*y + z,
  56. 2*x**2 - 4*x*z - y*z + 3*z**2,
  57. 2*x*y - 4*x*z - 3*y*z + 5*z**2}$
  58. % All parameters as they should be ?
  59. dim m2;
  60. 1$
  61. degree m2;
  62. 3$
  63. groebfactor m2;
  64. {{2*y**2 - 2*x*z - 7*y*z + 7*z**2,
  65. 3*t - 2*x - 2*y + z,
  66. 2*x**2 - 4*x*z - y*z + 3*z**2,
  67. 2*x*y - 4*x*z - 3*y*z + 5*z**2}}$
  68. % It seems to be prime ?
  69. isprime m2;
  70. no$
  71. % Not, of course, but it is known to be unmixed.
  72. % Hence we can use
  73. easyprimarydecomposition m2;
  74. {{{x - 2*z,y - 3*z,t - 3*z},
  75. {y - 3*z,x - 2*z,t - 3*z}},
  76. {{x - z,y - z,t - z},
  77. {y - z,x - z,t - z}},
  78. {{2*x - z,2*y - 3*z,t - z},
  79. {2*y - 3*z,2*x - z,t - z}}}$
  80. % Example 2 :
  81. % The affine monomial curve with generic point (t^7,t^9,t^10).
  82. setideal(m,affine_monomial_curve({7,9,10},{x,y,z}));
  83. {x**3*y - z**3,
  84. x**4 - y**2*z,
  85. y**3 - x*z**2}$
  86. % The base ring was changed as side effect :
  87. getring();
  88. {{x,y,z},{{7,9,10}},revlex,{7,9,10}}$
  89. vars:=first getring m;
  90. vars := {x,y,z}$
  91. % Some advanced commutative algebra :
  92. % The analytic spread of m.
  93. analytic_spread m;
  94. 3$
  95. % The Rees ring Rees_R(vars) over R=S/m.
  96. rees:=blowup(m,vars,{u,v,w});
  97. rees := {u**2*v*x - w**3,
  98. u*v*x**2 - w**2*z,
  99. v*x**3 - w*z**2,
  100. u**3*x - v**2*w,
  101. u**2*x**2 - v*w*y,
  102. u*x**3 - w*y**2,
  103. - u*w**2 + v**3,
  104. v**2*y - w**2*x,
  105. v*y**2 - w*x*z,
  106. v*z - w*y,
  107. u*z - w*x,
  108. u*y - v*x,
  109. x**3*y - z**3,
  110. x**4 - y**2*z,
  111. - x*z**2 + y**3}$
  112. % It is multihomogeneous wrt. the degree vectors, constructed during
  113. % blow up. Lets compute weighted Hilbert series :
  114. setideal(rees,rees)$
  115. weights:=second getring();
  116. weights := {{0,0,0,7,9,10},{7,9,10,0,0,0}}$
  117. weightedhilbertseries(gbasis rees,weights);
  118. ( - x**29*y + x**29 - x**20*y + x**20 - x**19*y**11 + x**19*y**10 - x**19*y + x
  119. **19 - x**18*y + x**18 - x**10*y**11 + x**10*y**10 - x**10*y + x**10 - x**9*y**
  120. 21 + x**9*y**20 - x**9*y**11 + x**9*y**9 - x**9*y + x**9 + y**23 - y**22 + y**16
  121. - y**15 + y**14 - y**11 + y**9 - y**8 + y**7 - y + 1)/(x**7*y - x**7 - y + 1)$
  122. % gr_R(vars), the associated graded ring of the irrelevant ideal
  123. % over R. The short way.
  124. interreduce sub(x=0,y=0,z=0,rees);
  125. {w**3,v**2*w, - u*w**2 + v**3}$
  126. % The long (and more general) way. Gives the result in another
  127. % embedding.
  128. % Restore the base ring, since it was changed by blowup as a side
  129. % effect.
  130. setring getring m$
  131. assgrad(m,vars,{u,v,w});
  132. {x,
  133. y,
  134. z,
  135. w**3,
  136. v**2*w,
  137. - u*w**2 + v**3}$
  138. % Comparing the Rees algebra and the symmetric algebra of M :
  139. setring getring m$
  140. setideal(rees,blowup({},m,{a,b,c}));
  141. { - y**2*a + z**2*b + x**3*c,
  142. x*a - y*b - z*c,
  143. - y**2*a**2 + z**2*a*b + x**2*y*b*c + x**2*z*c**2,
  144. - y**2*a**3 + z**2*a**2*b + x*y**2*b**2*c + 2*x*y*z*b*c**2 + x*z**2*c**3,
  145. - y**2*a**4 + z**2*a**3*b + y**3*b**3*c + 3*y**2*z*b**2*c**2 + 3*y*z**2*b*c**3
  146. + z**3*c**4}$
  147. % Lets test weighted Hilbert series once more :
  148. weights:=second getring();
  149. weights := {{0,0,0,30,28,27},{7,9,10,0,0,0}}$
  150. weightedhilbertseries(gbasis rees,weights);
  151. (x**58*y**27 + x**30*y**25 - x**30*y**18 - x**30*y**7 - x**28*y**27 + 1)/(x**85*
  152. y**26 - x**85*y**19 - x**85*y**17 - x**85*y**16 + x**85*y**10 + x**85*y**9 + x**
  153. 85*y**7 - x**85 - x**58*y**26 + x**58*y**19 + x**58*y**17 + x**58*y**16 - x**58*
  154. y**10 - x**58*y**9 - x**58*y**7 + x**58 - x**57*y**26 + x**57*y**19 + x**57*y**
  155. 17 + x**57*y**16 - x**57*y**10 - x**57*y**9 - x**57*y**7 + x**57 - x**55*y**26 +
  156. x**55*y**19 + x**55*y**17 + x**55*y**16 - x**55*y**10 - x**55*y**9 - x**55*y**7
  157. + x**55 + x**30*y**26 - x**30*y**19 - x**30*y**17 - x**30*y**16 + x**30*y**10 +
  158. x**30*y**9 + x**30*y**7 - x**30 + x**28*y**26 - x**28*y**19 - x**28*y**17 - x**
  159. 28*y**16 + x**28*y**10 + x**28*y**9 + x**28*y**7 - x**28 + x**27*y**26 - x**27*y
  160. **19 - x**27*y**17 - x**27*y**16 + x**27*y**10 + x**27*y**9 + x**27*y**7 - x**27
  161. - y**26 + y**19 + y**17 + y**16 - y**10 - y**9 - y**7 + 1)$
  162. % The symmetric algebra :
  163. setring getring m$
  164. setideal(sym,sym(m,{a,b,c}));
  165. {y**2*a - z**2*b - x**3*c,
  166. x*a - y*b - z*c}$
  167. modequalp(rees,sym);
  168. yes$
  169. % Symbolic powers :
  170. setring getring m$
  171. setideal(m2,idealpower(m,2));
  172. {x**6*y**2 - 2*x**3*y*z**3 + z**6,
  173. x**8 - 2*x**4*y**2*z + y**4*z**2,
  174. y**6 - 2*x*y**3*z**2 + x**2*z**4,
  175. x**7*y - x**3*y**3*z - x**4*z**3 + y**2*z**4,
  176. x**3*y**4 - x**4*y*z**2 - y**3*z**3 + x*z**5,
  177. x**4*y**3 - y**5*z - x**5*z**2 + x*y**2*z**3}$
  178. % Let's compute a second symbolic power :
  179. setideal(m3,symbolic_power(m,2));
  180. {x**6*y**2 - 2*x**3*y*z**3 + z**6,
  181. x**8 - 2*x**4*y**2*z + y**4*z**2,
  182. y**6 - 2*x*y**3*z**2 + x**2*z**4,
  183. x**2*y**5 + x**7*z - 3*x**3*y**2*z**2 + y*z**5,
  184. x**7*y - x**3*y**3*z - x**4*z**3 + y**2*z**4,
  185. x**3*y**4 - x**4*y*z**2 - y**3*z**3 + x*z**5,
  186. x**4*y**3 - y**5*z - x**5*z**2 + x*y**2*z**3}$
  187. % It is different from the ordinary second power.
  188. % Hence m2 has a trivial component.
  189. modequalp(m2,m3);
  190. no$
  191. % Test x for non zero divisor property :
  192. nzdp(x,m2);
  193. no$
  194. nzdp(x,m3);
  195. yes$
  196. % Here is the primary decomposition :
  197. pd:=primarydecomposition m2;
  198. pd := {{{x**8 - 2*x**4*y**2*z + y**4*z**2,
  199. x**6*y**2 - 2*x**3*y*z**3 + z**6,
  200. x**2*z**4 - 2*x*y**3*z**2 + y**6,
  201. x**7*z - 3*x**3*y**2*z**2 + x**2*y**5 + y*z**5,
  202. x**7*y - x**4*z**3 - x**3*y**3*z + y**2*z**4,
  203. - x**4*y*z**2 + x**3*y**4 + x*z**5 - y**3*z**3,
  204. - x**5*z**2 + x**4*y**3 + x*y**2*z**3 - y**5*z},
  205. { - x*z**2 + y**3,
  206. x**4 - y**2*z,
  207. x**3*y - z**3}},
  208. {{z**2,
  209. x**6*y**2,
  210. y**6,
  211. x**2*y**5*z,
  212. x**3*y**4,
  213. x**4*(x**4 - 2*y**2*z),
  214. x**3*y*(x**4 - y**2*z),
  215. y**3*(x**4 - y**2*z)},
  216. {x,z,y}}}$
  217. % Compare the result with m2 :
  218. setideal(m4,matintersect(first first pd, first second pd));
  219. {y**6 - 2*x*y**3*z**2 + x**2*z**4,
  220. x**6*y**2 - 2*x**3*y*z**3 + z**6,
  221. x**8 - 2*x**4*y**2*z + y**4*z**2,
  222. x**2*y**5*z + x**7*z**2 - 3*x**3*y**2*z**3 + y*z**6,
  223. x**4*y**3 - y**5*z - x**5*z**2 + x*y**2*z**3,
  224. x**3*y**4 - x**4*y*z**2 - y**3*z**3 + x*z**5,
  225. x**7*y - x**3*y**3*z - x**4*z**3 + y**2*z**4}$
  226. modequalp(m2,m4);
  227. yes$
  228. % Compare the result with m3 :
  229. setideal(m4,first first pd)$
  230. modequalp(m3,m4);
  231. yes$
  232. % The trivial component can also be removed with a stable
  233. % quotient computation :
  234. setideal(m5,matstabquot(m2,vars))$
  235. modequalp(m3,m5);
  236. yes$
  237. % Example 3 : The Macaulay curve.
  238. setideal(m,proj_monomial_curve({0,1,3,4},{w,x,y,z}));
  239. {x**3 - w**2*y,
  240. w*y**2 - x**2*z,
  241. y**3 - x*z**2,
  242. x*y - w*z}$
  243. vars:=first getring();
  244. vars := {w,x,y,z}$
  245. gbasis m;
  246. {x**3 - w**2*y,
  247. w*y**2 - x**2*z,
  248. y**3 - x*z**2,
  249. x*y - w*z}$
  250. % Test whether m is prime :
  251. isprime m;
  252. yes$
  253. % A resolution of m :
  254. resolve m;
  255. {
  256. mat((x**3 - w**2*y),(w*y**2 - x**2*z),(y**3 - x*z**2),(x*y - w*z))$
  257. ,
  258. mat((y,w,0, - x**2),(z,x,0, - w*y),(0, - y,w, - x*z),(0, - z,x, - y**2))$
  259. ,
  260. mat((z, - y, - x,w))$
  261. ,
  262. mat((0))$
  263. }$
  264. % m has depth = 1 as can be seen from the
  265. gradedbettinumbers m;
  266. {{0},{2,3,3,3},{4,4,4,4},{5}}$
  267. % Another way to see the non perfectness of m :
  268. hilbertseries m;
  269. ( - w**3 + 2*w**2 + 2*w + 1)/(w**2 - 2*w + 1)$
  270. % Just a third approach. Divide out a parameter system :
  271. ps:=for i:=1:2 collect random_linear_form(vars,1000);
  272. ps := {927*w + 880*x + 292*y + 9*z, - 819*w + 224*x - 572*y - 205*z}$
  273. setideal(m1,matsum(m,ps))$
  274. % dim should be zero and degree > degree m = 4.
  275. % A Gbasis for m1 is computed automatically.
  276. dim m1;
  277. 0$
  278. degree m1;
  279. 5$
  280. % The projections of m on the coord. hyperplanes.
  281. for each x in vars collect eliminate(m,{x});
  282. {{ - x*z**2 + y**3},
  283. { - w*z**3 + y**4},
  284. { - w**3*z + x**4},
  285. { - w**2*y + x**3}}$
  286. % Example 4 : Two submodules of S^4.
  287. % Get the stored result of the earlier computation.
  288. r:=resolve m$
  289. % See whether cali!=degrees contains a relict from earlier
  290. % computations.
  291. getdegrees();
  292. {}$
  293. % Introduce the 2nd and 3rd syzygy module as new modules.
  294. % Both are submodules in S^4.
  295. setmodule(m1,second r)$
  296. setmodule(m2,third r)$
  297. % The second is already a gbasis.
  298. setgbasis m2;
  299. mat((z, - y, - x,w))$
  300. getleadterms m1;
  301. mat((0,x**3,0,0),(0,0,x**3,0),(0,0,w**2*y,0),(0,0,w*y**2,0),(0,0,w*x,0),(0,0,0,x
  302. **2),(0,0,0,w*y),(0,0,0,x*z),(0,0,0,y**2))$
  303. getleadterms m2;
  304. mat((0,0,0,w))$
  305. % Since rk(F/M)=rk(F/in(M)), they have ranks 1 resp. 3.
  306. dim m1;
  307. 4$
  308. indepvarsets m1;
  309. {{w,x,y,z}}$
  310. % Its intersection is zero :
  311. matintersect(m1,m2);
  312. mat((0,0,0,0))$
  313. % Its sum :
  314. setmodule(m3,matsum(m1,m2));
  315. mat(( - y, - w,0,x**2),(0,y, - w,x*z),(0,z, - x,y**2),(z, - y, - x,w),( - y*z -
  316. z,y**2 - x,x*y,0))$
  317. dim m3;
  318. 3$
  319. % Hence it has a nontrivial annihilator :
  320. annihilator m3;
  321. {w**2*y*z + w**2*z - w*x*y + w*y**3 - x**3*z - x**2*y*z - x**2*z**2 + x*y**3}$
  322. % One can compute isolated primes and primary decomposition also for
  323. % modules. Let's do it, although being trivial here:
  324. isolatedprimes m3;
  325. {{w**2*y*z + w**2*z - w*x*y + w*y**3 - x**3*z - x**2*y*z - x**2*z**2 + x*y**3}}$
  326. primarydecomposition m3;
  327. {{
  328. mat((z*( - w*x*z - w*y*z + w*y - w*z + x**2*z + x*y*z - y**3 + y**2*z),w**2*y +
  329. w**2*z + w*x*y*z + w*x*z**2 - w*x*z + w*y*z**2 - x**2*z**2 + x*y**2*z, - w**3,0)
  330. ,(z*( - w*y - w - x*z + y**2), - w*x + w*y*z - x**2*z + x*y**2,w**2*y,0),( - x*z
  331. **2,w*y + x*y*z + x*z**2 - y**3,w*( - w + y**2),0),( - x*z**2,y*(w + x*z), - w**
  332. 2 + x**2*z,0),( - y*z, - (w*z + x*y),w*x,0),( - w*y**2 + x**2*z, - w**2*y + x**3
  333. ,0,0),(w*y*z - w*y + w*z - x**2*z + y**3 - y**2*z, - w**2 + w*x - w*y*z + x**2*y
  334. + x**2*z - x*y**2,0,0),( - w*y*z - w*z - y**3 + y**2*z, - w*x + w*y*z - x**2*z
  335. + x*y**2,x**3,0),(z*( - w*y - w + y**2), - w*x + w*y**2 + w*y*z + x*y**2,0,0),(
  336. - z*(y + 1), - x + y**2,x*y,0),(z, - y, - x,w),(w**2*y*z + w**2*z - w*x*y + w*y
  337. **3 - x**3*z - x**2*y*z - x**2*z**2 + x*y**3,0,0,0),( - y, - w,0,x**2),(0,y, - w
  338. ,x*z),(0,z, - x,y**2))$
  339. ,
  340. {w**2*y*z + w**2*z - w*x*y + w*y**3 - x**3*z - x**2*y*z - x**2*z**2 + x*y**3}}}$
  341. % To get a meaningful Hilbert series make m1 homogeneous :
  342. setdegrees {1,x,x,x};
  343. {1,x,x,x}$
  344. % Reevaluate m1 with the new column degrees.
  345. setmodule(m1,m1)$
  346. hilbertseries m1;
  347. (w**7 - 5*w**6 + 8*w**5 - 2*w**4 - 5*w**3 + 3*w + 1)/(w**4 - 4*w**3 + 6*w**2 - 4
  348. *w + 1)$
  349. % Example 5 : From the MACAULAY manual (D.Bayer, M.Stillman).
  350. % An elliptic curve on the Veronese in P^5.
  351. rvars:={x,y,z}$
  352. svars:={a,b,c,d,e,f}$
  353. r:=setring(rvars,degreeorder rvars,revlex)$
  354. s:=setring(svars,{for each x in svars collect 2},revlex)$
  355. map:={s,r,{a=x^2,b=x*y,c=x*z,d=y^2,e=y*z,f=z^2}};
  356. map := {{{a,
  357. b,
  358. c,
  359. d,
  360. e,
  361. f},
  362. {{2,2,2,2,2,2}},
  363. revlex,
  364. {1,1,1,1,1,1}},
  365. {{x,y,z},
  366. {{1,1,1}},
  367. revlex,
  368. {1,1,1}},
  369. {a=x**2,
  370. b=x*y,
  371. c=x*z,
  372. d=y**2,
  373. e=y*z,
  374. f=z**2}}$
  375. preimage({y^2z-x^3-x*z^2},map);
  376. { - a*d + b**2,
  377. - a*e + b*c,
  378. - b*e + c*d,
  379. - a*f + c**2,
  380. - b*f + c*e,
  381. - d*f + e**2,
  382. a**2 + a*f - b*e,
  383. a*b + b*f - d*e,
  384. a*c + c*f - d*f}$
  385. % Example 6 : The preimage under a rational map.
  386. r:=setring({x,y},{},lex)$
  387. s:=setring({t},{},lex)$
  388. map:={r,s,{x=2t/(t^2+1),y=(t^2-1)/(t^2+1)}};
  389. map := {{{x,y},{},lex,{1,1}},
  390. {{t},{},lex,{1}},
  391. {x=(2*t)/(t**2 + 1),y=(t**2 - 1)/(t**2 + 1)}}$
  392. % The preimage of (0) is the equation of the circle :
  393. ratpreimage({},map);
  394. {x**2 + y**2 - 1}$
  395. % The preimage of the point (t=3/2) :
  396. ratpreimage({2t-3},map);
  397. {13*x - 12,13*y - 5}$
  398. % Example 7 : A zerodimensional ideal.
  399. setring({x,y,z},{},lex)$
  400. setideal(n,{x**2 + y + z - 3,x + y**2 + z - 3,x + y + z**2 - 3});
  401. {x**2 + y + z - 3,x + y**2 + z - 3,x + y + z**2 - 3}$
  402. % The groebner algorithm with factorization :
  403. groebfactor n;
  404. {{y - 1,z - 1,x - 1},
  405. {y + 3,z + 3,x + 3},
  406. {y - z,z**2 - 2,x + z - 1},
  407. {z**2 - 2,x - z,y + z - 1},
  408. {y + z - 1,z**2 - 2*z - 1,x + z - 1}}$
  409. % Change the term order and reevaluate n :
  410. setring({x,y,z},{{1,1,1}},revlex)$
  411. setideal(n,n);
  412. {x**2 + y + z - 3,y**2 + x + z - 3,z**2 + x + y - 3}$
  413. % its primes :
  414. zeroprimes n;
  415. {{x - z,z**2 - 2,y + z - 1},
  416. {x + z - 1,y + z - 1,z**2 - 2*z - 1},
  417. {z - 1,x - 1,y - 1},
  418. {z + 3,x + 3,y + 3},
  419. {y - z,z**2 - 2,x + z - 1}}$
  420. % a vector space basis of S/n :
  421. getkbase n;
  422. {1,x,x*y,x*y*z,x*z,y,y*z,z}$
  423. % Example 8 : A modular computation. Since REDUCE has no multivariate
  424. % factorizer, factorprimes has to be turned off !
  425. on modular$
  426. off factorprimes$
  427. setmod 181;
  428. 1$
  429. setideal(n1,n);
  430. {x**2 + y + z + 178,y**2 + x + z + 178,z**2 + x + y + 178}$
  431. zeroprimes n1;
  432. {{y + 180*z,z**2 + 179,x + z + 180},
  433. {x + z + 180,y + z + 180,z**2 + 179*z + 180},
  434. {x + 180*z,z**2 + 179,y + z + 180},
  435. {z + 180,x + 180,y + 180},
  436. {z + 3,x + 3,y + 3}}$
  437. setmod 7;
  438. 181$
  439. setideal(n1,n);
  440. {x**2 + y + z + 4,y**2 + x + z + 4,z**2 + x + y + 4}$
  441. zeroprimes n1;
  442. {{z + 6,x + 6,y + 6},
  443. {x + 4,z + 4,y + 2},
  444. {x + 4,z + 2,y + 4},
  445. {z + 4,x + 2,y + 4},
  446. {x + 3,z + 3,y + 3}}$
  447. % Hence some of the primes glue together mod 7.
  448. zeroprimarydecomposition n1;
  449. {{{z + 6,x + 6,y + 6},
  450. {z + 6,x + 6,y + 6}},
  451. {{z + 4,y + 2,x + 4},
  452. {x + 4,z + 4,y + 2}},
  453. {{z + 2,y + 4,x + 4},
  454. {x + 4,z + 2,y + 4}},
  455. {{z + 4,x + 2,y + 4},
  456. {z + 4,x + 2,y + 4}},
  457. {{x**2 + y + z + 4,
  458. x + y**2 + z + 4,
  459. x + y + z**2 + 4,
  460. 3*(x + 5*y*z + 2*y + 2*z + 5),
  461. x*z + 6*x + 3*y + 6*z + 1,
  462. x*y + 6*x + 6*y + 3*z + 1},
  463. {x + 3,z + 3,y + 3}}}$
  464. off modular$
  465. on factorprimes$
  466. % Example 9 : Independent sets once more.
  467. n:=10$
  468. vars:=for i:=1:(2*n) collect mkid(x,i)$
  469. setring(vars,{},lex)$
  470. setideal(m,for j:=0:n collect
  471. for i:=(j+1):(j+n) product mkid(x,i));
  472. {x1*x2*x3*x4*x5*x6*x7*x8*x9*x10,
  473. x2*x3*x4*x5*x6*x7*x8*x9*x10*x11,
  474. x3*x4*x5*x6*x7*x8*x9*x10*x11*x12,
  475. x4*x5*x6*x7*x8*x9*x10*x11*x12*x13,
  476. x5*x6*x7*x8*x9*x10*x11*x12*x13*x14,
  477. x6*x7*x8*x9*x10*x11*x12*x13*x14*x15,
  478. x7*x8*x9*x10*x11*x12*x13*x14*x15*x16,
  479. x8*x9*x10*x11*x12*x13*x14*x15*x16*x17,
  480. x9*x10*x11*x12*x13*x14*x15*x16*x17*x18,
  481. x10*x11*x12*x13*x14*x15*x16*x17*x18*x19,
  482. x11*x12*x13*x14*x15*x16*x17*x18*x19*x20}$
  483. setgbasis m$
  484. indepvarsets m;
  485. {{x2,x3,x4,x5,x6,x7,x8,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  486. {x1,x3,x4,x5,x6,x7,x8,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  487. {x1,x2,x4,x5,x6,x7,x8,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  488. {x1,x2,x3,x5,x6,x7,x8,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  489. {x1,x2,x3,x4,x6,x7,x8,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  490. {x1,x2,x3,x4,x5,x7,x8,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  491. {x1,x2,x3,x4,x5,x6,x8,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  492. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  493. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  494. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x12,x13,x14,x15,x16,x17,x18,x19,x20},
  495. {x1,x3,x4,x5,x6,x7,x8,x9,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  496. {x1,x2,x4,x5,x6,x7,x8,x9,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  497. {x1,x2,x3,x5,x6,x7,x8,x9,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  498. {x1,x2,x3,x4,x6,x7,x8,x9,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  499. {x1,x2,x3,x4,x5,x7,x8,x9,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  500. {x1,x2,x3,x4,x5,x6,x8,x9,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  501. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  502. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  503. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x13,x14,x15,x16,x17,x18,x19,x20},
  504. {x1,x2,x4,x5,x6,x7,x8,x9,x10,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  505. {x1,x2,x3,x5,x6,x7,x8,x9,x10,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  506. {x1,x2,x3,x4,x6,x7,x8,x9,x10,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  507. {x1,x2,x3,x4,x5,x7,x8,x9,x10,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  508. {x1,x2,x3,x4,x5,x6,x8,x9,x10,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  509. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  510. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  511. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x14,x15,x16,x17,x18,x19,x20},
  512. {x1,x2,x3,x5,x6,x7,x8,x9,x10,x11,x12,x13,x15,x16,x17,x18,x19,x20},
  513. {x1,x2,x3,x4,x6,x7,x8,x9,x10,x11,x12,x13,x15,x16,x17,x18,x19,x20},
  514. {x1,x2,x3,x4,x5,x7,x8,x9,x10,x11,x12,x13,x15,x16,x17,x18,x19,x20},
  515. {x1,x2,x3,x4,x5,x6,x8,x9,x10,x11,x12,x13,x15,x16,x17,x18,x19,x20},
  516. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x11,x12,x13,x15,x16,x17,x18,x19,x20},
  517. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x13,x15,x16,x17,x18,x19,x20},
  518. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x13,x15,x16,x17,x18,x19,x20},
  519. {x1,x2,x3,x4,x6,x7,x8,x9,x10,x11,x12,x13,x14,x16,x17,x18,x19,x20},
  520. {x1,x2,x3,x4,x5,x7,x8,x9,x10,x11,x12,x13,x14,x16,x17,x18,x19,x20},
  521. {x1,x2,x3,x4,x5,x6,x8,x9,x10,x11,x12,x13,x14,x16,x17,x18,x19,x20},
  522. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x11,x12,x13,x14,x16,x17,x18,x19,x20},
  523. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x13,x14,x16,x17,x18,x19,x20},
  524. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x13,x14,x16,x17,x18,x19,x20},
  525. {x1,x2,x3,x4,x5,x7,x8,x9,x10,x11,x12,x13,x14,x15,x17,x18,x19,x20},
  526. {x1,x2,x3,x4,x5,x6,x8,x9,x10,x11,x12,x13,x14,x15,x17,x18,x19,x20},
  527. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x11,x12,x13,x14,x15,x17,x18,x19,x20},
  528. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x13,x14,x15,x17,x18,x19,x20},
  529. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x13,x14,x15,x17,x18,x19,x20},
  530. {x1,x2,x3,x4,x5,x6,x8,x9,x10,x11,x12,x13,x14,x15,x16,x18,x19,x20},
  531. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x11,x12,x13,x14,x15,x16,x18,x19,x20},
  532. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x13,x14,x15,x16,x18,x19,x20},
  533. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x13,x14,x15,x16,x18,x19,x20},
  534. {x1,x2,x3,x4,x5,x6,x7,x9,x10,x11,x12,x13,x14,x15,x16,x17,x19,x20},
  535. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x13,x14,x15,x16,x17,x19,x20},
  536. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x13,x14,x15,x16,x17,x19,x20},
  537. {x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x13,x14,x15,x16,x17,x18,x20},
  538. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x13,x14,x15,x16,x17,x18,x20},
  539. {x1,x2,x3,x4,x5,x6,x7,x8,x9,x11,x12,x13,x14,x15,x16,x17,x18,x19}}$
  540. dim m;
  541. 18$
  542. degree m;
  543. 55$
  544. comment
  545. ####################################
  546. ### ###
  547. ### Local Standard Bases ###
  548. ### ###
  549. ####################################
  550. end comment;
  551. % Example 10 : An example from [ Alonso, Mora, Raimondo ]
  552. vars := {z,x,y}$
  553. r:=setring(vars,{},lex)$
  554. setideal(m,{x^3+(x^2-y^2)*z+z^4,y^3+(x^2-y^2)*z-z^4});
  555. {z**4 + z*x**2 - z*y**2 + x**3,
  556. - z**4 + z*x**2 - z*y**2 + y**3}$
  557. dim m;
  558. 1$
  559. degree m;
  560. 12$
  561. % 2 = codim m is the codimension of the curve m. The defining
  562. % equations of the singular locus with their nilpotent structure :
  563. singular_locus(m,2);
  564. {x**3 - y**3 + 2*z**4,
  565. x**3 + 2*x**2*z + y**3 - 2*y**2*z,
  566. y*(8*x**3 + 3*x**2*y - 11*y**3 + 12*y*z**3),
  567. y*(x**3 + 3*x**2*y + 2*x*y*z + y**3 - 2*y**2*z),
  568. 3*x**5 + 3*x**4*y + 22*x**4 + 18*x**3*y**2 + 16*x**3*y + 21*x**2*y**3 + 3*x*y**4
  569. - 16*x*y**3 + 18*y**5 - 42*y**4*z - 22*y**4 + 24*y**3*z**2}$
  570. groebfactor ws;
  571. {{y,x,z},{81*x + 256,27*z - 64,81*y - 256}}$
  572. % Hence this curve has two singular points :
  573. % (x=y=z=0) and (y=-x=256/81,z=64/27)
  574. % Let's find the brances of the curve through the origin.
  575. % The first critical tropism is (-1,-1,-1).
  576. off noetherian$
  577. setring(vars,{{-1,-1,-1}},lex)$
  578. setideal(m,m);
  579. {z*x**2 - z*y**2 + x**3 + z**4,
  580. z*x**2 - z*y**2 + y**3 - z**4}$
  581. % Let's first test two different approaches, not fully
  582. % integrated into the algebraic interface :
  583. setideal(m1,homstbasis m);
  584. {x**3 - y**3 + 2*z**4,
  585. z*x**2 - z*y**2 + y**3 - z**4,
  586. z*x*y**2 - z*y**3 - x*y**3 + 2*z**5 + z**4*x,
  587. x**2*y**3 + x*y**4 + y**5 - 2*z**5*x - 2*z**5*y - z**4*x**2 - z**4*x*y - z**4*y
  588. **2,
  589. 6*z*y**5 + 2*x*y**5 - 2*y**6 - 4*z**6*x - 4*z**6*y - 2*z**5*x*y - 8*z**5*y**2 +
  590. z**4*x**3 - 2*z**4*x*y**2 + 3*z**4*y**3}$
  591. setideal(m2,lazystbasis m);
  592. {x**3 - y**3 + 2*z**4,
  593. z*x**2 - z*y**2 + y**3 - z**4,
  594. z*x*y**2 - z*y**3 - x*y**3 + 2*z**5 + z**4*x,
  595. x**2*y**3 + x*y**4 + y**5 - 2*z**5*x - 2*z**5*y - z**4*x**2 - z**4*x*y - z**4*y
  596. **2,
  597. 3*z*y**5 + x*y**5 - y**6 - 2*z**6*x - 2*z**6*y - z**5*x**2 - z**5*x*y - 3*z**5*y
  598. **2 - z**4*x*y**2 + z**4*y**3}$
  599. setgbasis m1$
  600. setgbasis m2$
  601. modequalp(m1,m2);
  602. yes$
  603. gbasis m;
  604. {x**3 - y**3 + 2*z**4,
  605. z*x**2 - z*y**2 + y**3 - z**4,
  606. z*x*y**2 - z*y**3 - x*y**3 + 2*z**5 + z**4*x,
  607. x**2*y**3 + x*y**4 + y**5 - 2*z**5*x - 2*z**5*y - z**4*x**2 - z**4*x*y - z**4*y
  608. **2,
  609. 3*z*y**5 + x*y**5 - y**6 - 2*z**6*x - 2*z**6*y - z**5*x**2 - z**5*x*y - 3*z**5*y
  610. **2 - z**4*x*y**2 + z**4*y**3}$
  611. modequalp(m,m1);
  612. yes$
  613. dim m;
  614. 1$
  615. degree m;
  616. 9$
  617. % Find the tangent directions not in z-direction :
  618. tangentcone m;
  619. {x**3 - y**3,
  620. z*x**2 - z*y**2 + y**3,
  621. z*x*y**2 - z*y**3 - x*y**3,
  622. x**2*y**3 + x*y**4 + y**5,
  623. 3*z*y**5 + x*y**5 - y**6}$
  624. setideal(n,sub(z=1,ws));
  625. {x**3 - y**3,
  626. x**2 - y**2 + y**3,
  627. x*y**2 - y**3 - x*y**3,
  628. x**2*y**3 + x*y**4 + y**5,
  629. 3*y**5 + x*y**5 - y**6}$
  630. setring r$
  631. on noetherian$
  632. setideal(n,n)$
  633. degree n;
  634. 9$
  635. % The points of n outside the origin.
  636. matstabquot(n,{x,y});
  637. {y**2 - 3*y + 3,x - y + 3}$
  638. % Hence there are two branches x=z'*(a-3+x'),y=z'*(a+y'),z=z'
  639. % with the algebraic number a : a^2-3a+3=0
  640. % and the new equations for (z',x',y') :
  641. setrules {a^2=>3a-3};
  642. {a**2 => 3*a - 3}$
  643. sub(x=z*(a-3+x),y=z*(a+y),m);
  644. {z**3*(a**3 + 3*a**2*x - 9*a**2 + 3*a*x**2 - 16*a*x - 2*a*y + 21*a + x**3 - 8*x
  645. **2 + 21*x - y**2 + z - 18),
  646. z**3*(a**3 + 3*a**2*y + 2*a*x + 3*a*y**2 - 2*a*y - 6*a + x**2 - 6*x + y**3 - y**
  647. 2 - z + 9)}$
  648. setideal(m1,matqquot(ws,z));
  649. {x**3 + (3*a - 7)*x**2 - (5*a - 6)*x + y**3 + (3*a - 2)*y**2 + (5*a - 9)*y,
  650. z - x**2 - (2*a - 6)*x - y**3 - (3*a - 1)*y**2 - (7*a - 9)*y}$
  651. % This defines a loc. smooth system at the origin, since the
  652. % jacobian at the origin of the gbasis is nonsingular :
  653. off noetherian$
  654. setring getring m;
  655. {{z,x,y},{{-1,-1,-1}},lex,{1,1,1}}$
  656. setideal(m1,m1);
  657. { - (5*a - 6)*x + (5*a - 9)*y + (3*a - 7)*x**2 + (3*a - 2)*y**2 + x**3 + y**3,
  658. z - (2*a - 6)*x - (7*a - 9)*y - x**2 - (3*a - 1)*y**2 - y**3}$
  659. gbasis m1;
  660. {(5*a - 6)*x - (5*a - 9)*y - (3*a - 7)*x**2 - (3*a - 2)*y**2 - x**3 - y**3,
  661. (5*a - 6)*z + 27*y + (9*a - 18)*x**2 - (18*a - 45)*y**2 - (2*a - 6)*x**3 - (7*a
  662. - 12)*y**3}$
  663. % clear the rules previously set.
  664. setrules {};
  665. {}$
  666. % Example 11 : The standard basis of another example.
  667. % Comparing different approaches.
  668. vars:={x,y}$
  669. setring(vars,localorder vars,lex);
  670. {{x,y},{{-1,-1}},lex,{1,1}}$
  671. ff:=x^5+y^11+(x+x^3)*y^9;
  672. ff := x**5 + x**3*y**9 + x*y**9 + y**11$
  673. setideal(p1,mat2list matjac({ff},vars));
  674. {5*x**4 + y**9 + 3*x**2*y**9,
  675. 9*x*y**8 + 11*y**10 + 9*x**3*y**8}$
  676. gbasis p1;
  677. {5*x**4 + y**9 + 3*x**2*y**9,
  678. 9*x*y**8 + 11*y**10 + 9*x**3*y**8,
  679. 73205*y**16 + 6561*y**17 - 32805*x**10*y**8 + 294030*x**6*y**12 - 292820*x**2*y
  680. **16 + 120285*x**9*y**10 - 239580*x**5*y**14 + 19683*x**2*y**17}$
  681. gbtestversion 2$
  682. setideal(p2,p1);
  683. {5*x**4 + y**9 + 3*x**2*y**9,
  684. 9*x*y**8 + 11*y**10 + 9*x**3*y**8}$
  685. gbasis p2;
  686. {5*x**4 + y**9 + 3*x**2*y**9,
  687. 9*x*y**8 + 11*y**10 + 9*x**3*y**8,
  688. 73205*y**16 + 6561*y**17 - 32805*x**10*y**8 + 294030*x**6*y**12 - 292820*x**2*y
  689. **16 + 120285*x**9*y**10 - 239580*x**5*y**14 + 19683*x**2*y**17}$
  690. gbtestversion 3$
  691. setideal(p3,p1);
  692. {5*x**4 + y**9 + 3*x**2*y**9,
  693. 9*x*y**8 + 11*y**10 + 9*x**3*y**8}$
  694. gbasis p3;
  695. {5*x**4 + y**9 + 3*x**2*y**9,
  696. 9*x*y**8 + 11*y**10 + 9*x**3*y**8,
  697. 73205*y**16 + 6561*y**17 - 32805*x**10*y**8 + 294030*x**6*y**12 - 292820*x**2*y
  698. **16 + 120285*x**9*y**10 - 239580*x**5*y**14 + 19683*x**2*y**17}$
  699. gbtestversion 1$
  700. modequalp(p1,p2);
  701. yes$
  702. modequalp(p1,p3);
  703. yes$
  704. dim p1;
  705. 0$
  706. degree p1;
  707. 40$
  708. % Example 12 : A local intersection wrt. a non inflimited term order.
  709. setring({x,y,z},{},revlex);
  710. {{x,y,z},{},revlex,{1,1,1}}$
  711. m1:=matintersect({x-y^2,y-x^2},{x-z^2,z-x^2},{y-z^2,z-y^2});
  712. m1 := {y*z - x**3*y*z - x*y*z**2 + x**4*y*z**2 - y**2*z**2 + x**3*y**2*z**2 + x*
  713. y**2*z**3 - x**4*y**2*z**3,
  714. x*z - x**2*y*z - x**2*z**2 - x*y*z**2 + x**3*y*z**2 + x**2*y**2*z**2 + x**2*y*z
  715. **3 - x**3*y**2*z**3,
  716. x*y - x**2*y**2 - x**2*y*z - x*y**2*z + x**3*y**2*z + x**2*y**3*z + x**2*y**2*z
  717. **2 - x**3*y**3*z**2}$
  718. % Delete polynomial units post factum :
  719. deleteunits ws;
  720. {y*z,x*z,x*y}$
  721. % Detecting polynomial units early :
  722. on detectunits;
  723. m1:=matintersect({x-y^2,y-x^2},{x-z^2,z-x^2},{y-z^2,z-y^2});
  724. m1 := {y*z,x*z,x*y}$
  725. off detectunits;
  726. comment
  727. ####################################
  728. ### ###
  729. ### More Advanced Computations ###
  730. ### ###
  731. ####################################
  732. end comment;
  733. % Return to a noetherian term order:
  734. vars:={x,y,z}$
  735. setring(vars,degreeorder vars,revlex);
  736. {{x,y,z},{{1,1,1}},revlex,{1,1,1}}$
  737. on noetherian;
  738. % Example 13 : Use of "mod".
  739. % Polynomials modulo ideals :
  740. setideal(m,{2x^2+y+5,3y^2+z+7,7z^2+x+1});
  741. {2*x**2 + y + 5,3*y**2 + z + 7,7*z**2 + x + 1}$
  742. x^2*y^2*z^2 mod m;
  743. ( - x*y*z - 7*x*y - 5*x*z - 35*x - y*z - 7*y - 5*z - 35)/42$
  744. % Lists of polynomials modulo ideals :
  745. {x^3,y^3,z^3} mod gbasis m;
  746. {(x*( - y - 5))/2,(y*( - z - 7))/3,( - z*(x + 1))/7}$
  747. % Matrices modulo modules :
  748. mm:=mat((x^4,y^4,z^4));
  749. mm := mat((x**4,y**4,z**4))$
  750. mm1:=tp<< ideal2mat m>>;
  751. mm1 := mat((2*x**2 + y + 5,3*y**2 + z + 7,x + 7*z**2 + 1))$
  752. mm mod mm1;
  753. mat(((y**2 + 10*y + 25)/4,( - 6*x**2*y**2 - 2*x**2*z - 14*x**2 + 4*y**4 + 3*y**3
  754. + 15*y**2 + y*z + 7*y + 5*z + 35)/4,( - 2*x**3 - 14*x**2*z**2 - 2*x**2 + x*y +
  755. 5*x + 7*y*z**2 + y + 4*z**4 + 35*z**2 + 5)/4))$
  756. % Example 14 : Powersums through elementary symmetric functions.
  757. vars:={a,b,c,d,e1,e2,e3,e4}$
  758. setring(vars,{},lex)$
  759. m:=interreduce {a+b+c+d-e1,
  760. a*b+a*c+a*d+b*c+b*d+c*d-e2,
  761. a*b*c+a*b*d+a*c*d+b*c*d-e3,
  762. a*b*c*d-e4};
  763. m := {d**4 - d**3*e1 + d**2*e2 - d*e3 + e4,
  764. a + b + c + d - e1,
  765. c**3 + c**2*d - c**2*e1 + c*d**2 - c*d*e1 + c*e2 + d**3 - d**2*e1 + d*e2 - e3,
  766. b**2 + b*c + b*d - b*e1 + c**2 + c*d - c*e1 + d**2 - d*e1 + e2}$
  767. for n:=1:5 collect a^n+b^n+c^n+d^n mod m;
  768. {e1,
  769. e1**2 - 2*e2,
  770. e1**3 - 3*e1*e2 + 3*e3,
  771. e1**4 - 4*e1**2*e2 + 4*e1*e3 + 2*e2**2 - 4*e4,
  772. e1**5 - 5*e1**3*e2 + 5*e1**2*e3 + 5*e1*e2**2 - 5*e1*e4 - 5*e2*e3}$
  773. % Example 15 : The setrules mechanism.
  774. setring({x,y,z},{},lex)$
  775. setrules {aa^3=>aa+1};
  776. {aa**3 => aa + 1}$
  777. setideal(m,{x^2+y+z-aa,x+y^2+z-aa,x+y+z^2-aa});
  778. {x**2 + y + z - aa,x + y**2 + z - aa,x + y + z**2 - aa}$
  779. gbasis m;
  780. {y**2 - y - z**2 + z,
  781. x + y + z**2 - aa,
  782. 2*y*z**2 - (2*aa - 2)*y + z**4 - (2*aa - 1)*z**2 + (aa**2 - aa),
  783. z**6 - (3*aa + 1)*z**4 + 4*z**3 + (3*aa**2 - 2*aa - 2)*z**2 - (4*aa - 4)*z + (3*
  784. aa**2 - 3*aa - 1)}$
  785. % Clear the rules previously set.
  786. setrules {};
  787. {}$
  788. % Example 16 : The same example with advanced coefficient domains.
  789. load_package arnum;
  790. defpoly aa^3-aa-1;
  791. setideal(m,{x^2+y+z-aa,x+y^2+z-aa,x+y+z^2-aa});
  792. {x**2 + y + z - aa,x + y**2 + z - aa,x + y + z**2 - aa}$
  793. gbasis m;
  794. {y**2 - y - z**2 + z,
  795. x + y + z**2 - aa,
  796. y*z**2 - (aa - 1)*y + 1/2*z**4 - (aa - 1/2)*z**2 + (1/2*aa**2 - 1/2*aa),
  797. z**6 - (3*aa + 1)*z**4 + 4*z**3 + (3*aa**2 - 2*aa - 2)*z**2 - (4*aa - 4)*z + (3*
  798. aa**2 - 3*aa - 1)}$
  799. % The following needs some more time since factorization of
  800. % arnum's is not so easy :
  801. groebfactor m;
  802. {{y - (aa**2 - aa - 1),
  803. z - (aa**2 - aa - 1),
  804. x + (aa**2 - aa - 2)},
  805. {y + (aa**2 - aa - 1),
  806. z + (aa**2 - aa - 1),
  807. x - (aa**2 - aa)},
  808. {y - z,x - z,z**2 + 2*z - aa},
  809. {z - (aa**2 - aa),
  810. y + (aa**2 - aa - 1),
  811. x + (aa**2 - aa - 1)},
  812. {z - (aa**2 - aa - 1),
  813. y + (aa**2 - aa - 2),
  814. x - (aa**2 - aa - 1)},
  815. {z + (aa**2 - aa - 2),
  816. y - (aa**2 - aa - 1),
  817. x - (aa**2 - aa - 1)},
  818. {z + (aa**2 - aa - 1),
  819. y - (aa**2 - aa),
  820. x + (aa**2 - aa - 1)}}$
  821. off arnum;
  822. off rational;
  823. comment
  824. ####################################
  825. ### ###
  826. ### Using Advanced Scripts in ###
  827. ### a Complex Example ###
  828. ### ###
  829. ####################################
  830. end comment;
  831. % Example 17 : The square of the 2-minors of a symmetric 3x3-matrix.
  832. vars:=for i:=1:6 collect mkid(x,i);
  833. vars := {x1,
  834. x2,
  835. x3,
  836. x4,
  837. x5,
  838. x6}$
  839. setring(vars,degreeorder vars,revlex);
  840. {{x1,x2,x3,x4,x5,x6},{{1,1,1,1,1,1}},revlex,{1,1,1,1,1,1}}$
  841. % Generating the ideal :
  842. mm:=mat((x1,x2,x3),(x2,x4,x5),(x3,x5,x6));
  843. mm := mat((x1,x2,x3),(x2,x4,x5),(x3,x5,x6))$
  844. m:=ideal_of_minors(mm,2);
  845. m := { - x1*x4 + x2**2,
  846. - x1*x5 + x2*x3,
  847. - x1*x6 + x3**2,
  848. - x2*x5 + x3*x4,
  849. - x2*x6 + x3*x5,
  850. - x4*x6 + x5**2}$
  851. setideal(n,idealpower(m,2));
  852. {x2**4 - 2*x1*x2**2*x4 + x1**2*x4**2,
  853. x3**4 - 2*x1*x3**2*x6 + x1**2*x6**2,
  854. x5**4 - 2*x4*x5**2*x6 + x4**2*x6**2,
  855. x2**2*x3**2 - 2*x1*x2*x3*x5 + x1**2*x5**2,
  856. x3**2*x5**2 - 2*x2*x3*x5*x6 + x2**2*x6**2,
  857. x2**3*x3 - x1*x2*x3*x4 - x1*x2**2*x5 + x1**2*x4*x5,
  858. x2*x3**3 - x1*x3**2*x5 - x1*x2*x3*x6 + x1**2*x5*x6,
  859. x2**2*x3*x4 - x1*x3*x4**2 - x2**3*x5 + x1*x2*x4*x5,
  860. x2**2*x3*x5 - x1*x3*x4*x5 - x2**3*x6 + x1*x2*x4*x6,
  861. x2*x3**2*x5 - x1*x3*x5**2 - x2**2*x3*x6 + x1*x2*x5*x6,
  862. x3**3*x5 - x2*x3**2*x6 - x1*x3*x5*x6 + x1*x2*x6**2,
  863. x2**2*x5**2 - x1*x4*x5**2 - x2**2*x4*x6 + x1*x4**2*x6,
  864. x2*x3*x5**2 - x1*x5**3 - x2*x3*x4*x6 + x1*x4*x5*x6,
  865. x3*x4*x5**2 - x2*x5**3 - x3*x4**2*x6 + x2*x4*x5*x6,
  866. x3*x5**3 - x3*x4*x5*x6 - x2*x5**2*x6 + x2*x4*x6**2,
  867. x3**2*x4**2 - 2*x2*x3*x4*x5 + x1*x4*x5**2 + x2**2*x4*x6 - x1*x4**2*x6,
  868. x2*x3**2*x4 - 2*x1*x3*x4*x5 + x1*x2*x5**2 - x2**3*x6 + x1*x2*x4*x6,
  869. x3**3*x4 - x1*x3*x5**2 - x2**2*x3*x6 - x1*x3*x4*x6 + 2*x1*x2*x5*x6,
  870. x3**2*x4*x5 - x1*x5**3 - 2*x2*x3*x4*x6 + x2**2*x5*x6 + x1*x4*x5*x6,
  871. x3**2*x4*x6 - 2*x2*x3*x5*x6 + x1*x5**2*x6 + x2**2*x6**2 - x1*x4*x6**2,
  872. x1*x3**2*x4 - 2*x1*x2*x3*x5 + x1**2*x5**2 + x1*x2**2*x6 - x1**2*x4*x6}$
  873. % The ideal itself :
  874. gbasis n;
  875. {x2**4 - 2*x1*x2**2*x4 + x1**2*x4**2,
  876. x3**4 - 2*x1*x3**2*x6 + x1**2*x6**2,
  877. x5**4 - 2*x4*x5**2*x6 + x4**2*x6**2,
  878. x2**2*x3**2 - 2*x1*x2*x3*x5 + x1**2*x5**2,
  879. x3**2*x5**2 - 2*x2*x3*x5*x6 + x2**2*x6**2,
  880. x2**3*x3 - x1*x2*x3*x4 - x1*x2**2*x5 + x1**2*x4*x5,
  881. x2*x3**3 - x1*x3**2*x5 - x1*x2*x3*x6 + x1**2*x5*x6,
  882. x2**2*x3*x4 - x1*x3*x4**2 - x2**3*x5 + x1*x2*x4*x5,
  883. x2**2*x3*x5 - x1*x3*x4*x5 - x2**3*x6 + x1*x2*x4*x6,
  884. x2*x3**2*x5 - x1*x3*x5**2 - x2**2*x3*x6 + x1*x2*x5*x6,
  885. x3**3*x5 - x2*x3**2*x6 - x1*x3*x5*x6 + x1*x2*x6**2,
  886. x2**2*x5**2 - x1*x4*x5**2 - x2**2*x4*x6 + x1*x4**2*x6,
  887. x2*x3*x5**2 - x1*x5**3 - x2*x3*x4*x6 + x1*x4*x5*x6,
  888. x3*x4*x5**2 - x2*x5**3 - x3*x4**2*x6 + x2*x4*x5*x6,
  889. x3*x5**3 - x3*x4*x5*x6 - x2*x5**2*x6 + x2*x4*x6**2,
  890. x3**2*x4**2 - 2*x2*x3*x4*x5 + x1*x4*x5**2 + x2**2*x4*x6 - x1*x4**2*x6,
  891. x2*x3**2*x4 - 2*x1*x3*x4*x5 + x1*x2*x5**2 - x2**3*x6 + x1*x2*x4*x6,
  892. x3**3*x4 - x1*x3*x5**2 - x2**2*x3*x6 - x1*x3*x4*x6 + 2*x1*x2*x5*x6,
  893. x3**2*x4*x5 - x1*x5**3 - 2*x2*x3*x4*x6 + x2**2*x5*x6 + x1*x4*x5*x6,
  894. x3**2*x4*x6 - 2*x2*x3*x5*x6 + x1*x5**2*x6 + x2**2*x6**2 - x1*x4*x6**2,
  895. x1*x3**2*x4 - 2*x1*x2*x3*x5 + x1**2*x5**2 + x1*x2**2*x6 - x1**2*x4*x6}$
  896. length n;
  897. 21$
  898. dim n;
  899. 3$
  900. degree n;
  901. 16$
  902. % Its radical.
  903. radical n;
  904. { - x1*x5 + x2*x3,
  905. - x2*x5 + x3*x4,
  906. - x2*x6 + x3*x5,
  907. - x1*x4 + x2**2,
  908. - x1*x6 + x3**2,
  909. - x4*x6 + x5**2}$
  910. % Its unmixed radical.
  911. unmixedradical n;
  912. { - x1*x5 + x2*x3,
  913. x2*x5 - x3*x4,
  914. - x2*x6 + x3*x5,
  915. - x1*x4 + x2**2,
  916. - x1*x6 + x3**2,
  917. - x4*x6 + x5**2}$
  918. % Its equidimensional hull :
  919. n1:=eqhull n;
  920. n1 := {x1**2*x4**2 - 2*x1*x2**2*x4 + x2**4,
  921. x1**2*x6**2 - 2*x1*x3**2*x6 + x3**4,
  922. x4**2*x6**2 - 2*x4*x5**2*x6 + x5**4,
  923. x1**2*x5**2 - 2*x1*x2*x3*x5 + x2**2*x3**2,
  924. x2**2*x6**2 - 2*x2*x3*x5*x6 + x3**2*x5**2,
  925. x1**2*x4*x5 - x1*x2**2*x5 - x1*x2*x3*x4 + x2**3*x3,
  926. x1**2*x5*x6 - x1*x2*x3*x6 - x1*x3**2*x5 + x2*x3**3,
  927. x1*x2*x4*x5 - x1*x3*x4**2 - x2**3*x5 + x2**2*x3*x4,
  928. x1*x2*x4*x6 - x1*x3*x4*x5 - x2**3*x6 + x2**2*x3*x5,
  929. x1*x2*x5*x6 - x1*x3*x5**2 - x2**2*x3*x6 + x2*x3**2*x5,
  930. x1*x2*x6**2 - x1*x3*x5*x6 - x2*x3**2*x6 + x3**3*x5,
  931. x1*x4**2*x6 - x1*x4*x5**2 - x2**2*x4*x6 + x2**2*x5**2,
  932. x1*x4*x5*x6 - x1*x5**3 - x2*x3*x4*x6 + x2*x3*x5**2,
  933. x2*x4*x5*x6 - x2*x5**3 - x3*x4**2*x6 + x3*x4*x5**2,
  934. x2*x4*x6**2 - x2*x5**2*x6 - x3*x4*x5*x6 + x3*x5**3,
  935. - x1*x4*x6 + x1*x5**2 + x2**2*x6 - 2*x2*x3*x5 + x3**2*x4}$
  936. length n1;
  937. 16$
  938. setideal(n1,n1)$
  939. submodulep(n,n1);
  940. yes$
  941. submodulep(n1,n);
  942. no$
  943. % Hence there is an embedded component. Let's find it making
  944. % an excursion to symbolic mode. Of course, this can be done
  945. % also algebraically.
  946. symbolic;
  947. nil
  948. n:=get('n,'basis);
  949. (dpmat 21 0 ((1 ((((0 0 4) 4) . 1) (((0 1 2 0 1) 4) . -2) (((0 2 0 0 2) 4) . 1))
  950. 3 0 nil) (2 ((((0 0 0 4) 4) . 1) (((0 1 0 2 0 0 1) 4) . -2) (((0 2 0 0 0 0 2) 4)
  951. . 1)) 3 0 nil) (3 ((((0 0 0 0 0 4) 4) . 1) (((0 0 0 0 1 2 1) 4) . -2) (((0 0 0 0
  952. 2 0 2) 4) . 1)) 3 0 nil) (4 ((((0 0 2 2) 4) . 1) (((0 1 1 1 0 1) 4) . -2) (((0 2
  953. 0 0 0 2) 4) . 1)) 3 0 nil) (5 ((((0 0 0 2 0 2) 4) . 1) (((0 0 1 1 0 1 1) 4) . -2
  954. ) (((0 0 2 0 0 0 2) 4) . 1)) 3 0 nil) (6 ((((0 0 3 1) 4) . 1) (((0 1 1 1 1) 4) .
  955. -1) (((0 1 2 0 0 1) 4) . -1) (((0 2 0 0 1 1) 4) . 1)) 4 0 nil) (7 ((((0 0 1 3) 4
  956. ) . 1) (((0 1 0 2 0 1) 4) . -1) (((0 1 1 1 0 0 1) 4) . -1) (((0 2 0 0 0 1 1) 4) .
  957. 1)) 4 0 nil) (8 ((((0 0 2 1 1) 4) . 1) (((0 1 0 1 2) 4) . -1) (((0 0 3 0 0 1) 4)
  958. . -1) (((0 1 1 0 1 1) 4) . 1)) 4 0 nil) (9 ((((0 0 2 1 0 1) 4) . 1) (((0 1 0 1 1
  959. 1) 4) . -1) (((0 0 3 0 0 0 1) 4) . -1) (((0 1 1 0 1 0 1) 4) . 1)) 4 0 nil) (10 (
  960. (((0 0 1 2 0 1) 4) . 1) (((0 1 0 1 0 2) 4) . -1) (((0 0 2 1 0 0 1) 4) . -1) (((0
  961. 1 1 0 0 1 1) 4) . 1)) 4 0 nil) (11 ((((0 0 0 3 0 1) 4) . 1) (((0 0 1 2 0 0 1) 4)
  962. . -1) (((0 1 0 1 0 1 1) 4) . -1) (((0 1 1 0 0 0 2) 4) . 1)) 4 0 nil) (12 ((((0 0
  963. 2 0 0 2) 4) . 1) (((0 1 0 0 1 2) 4) . -1) (((0 0 2 0 1 0 1) 4) . -1) (((0 1 0 0 2
  964. 0 1) 4) . 1)) 4 0 nil) (13 ((((0 0 1 1 0 2) 4) . 1) (((0 1 0 0 0 3) 4) . -1) (((
  965. 0 0 1 1 1 0 1) 4) . -1) (((0 1 0 0 1 1 1) 4) . 1)) 4 0 nil) (14 ((((0 0 0 1 1 2)
  966. 4) . 1) (((0 0 1 0 0 3) 4) . -1) (((0 0 0 1 2 0 1) 4) . -1) (((0 0 1 0 1 1 1) 4)
  967. . 1)) 4 0 nil) (15 ((((0 0 0 1 0 3) 4) . 1) (((0 0 0 1 1 1 1) 4) . -1) (((0 0 1 0
  968. 0 2 1) 4) . -1) (((0 0 1 0 1 0 2) 4) . 1)) 4 0 nil) (16 ((((0 0 0 2 2) 4) . 1) (
  969. ((0 0 1 1 1 1) 4) . -2) (((0 1 0 0 1 2) 4) . 1) (((0 0 2 0 1 0 1) 4) . 1) (((0 1
  970. 0 0 2 0 1) 4) . -1)) 5 0 nil) (17 ((((0 0 1 2 1) 4) . 1) (((0 1 0 1 1 1) 4) . -2
  971. ) (((0 1 1 0 0 2) 4) . 1) (((0 0 3 0 0 0 1) 4) . -1) (((0 1 1 0 1 0 1) 4) . 1)) 5
  972. 0 nil) (18 ((((0 0 0 3 1) 4) . 1) (((0 1 0 1 0 2) 4) . -1) (((0 0 2 1 0 0 1) 4) .
  973. -1) (((0 1 0 1 1 0 1) 4) . -1) (((0 1 1 0 0 1 1) 4) . 2)) 5 0 nil) (19 ((((0 0 0
  974. 2 1 1) 4) . 1) (((0 1 0 0 0 3) 4) . -1) (((0 0 1 1 1 0 1) 4) . -2) (((0 0 2 0 0 1
  975. 1) 4) . 1) (((0 1 0 0 1 1 1) 4) . 1)) 5 0 nil) (20 ((((0 0 0 2 1 0 1) 4) . 1) ((
  976. (0 0 1 1 0 1 1) 4) . -2) (((0 1 0 0 0 2 1) 4) . 1) (((0 0 2 0 0 0 2) 4) . 1) (((
  977. 0 1 0 0 1 0 2) 4) . -1)) 5 0 nil) (21 ((((0 1 0 2 1) 4) . 1) (((0 1 1 1 0 1) 4) .
  978. -2) (((0 2 0 0 0 2) 4) . 1) (((0 1 2 0 0 0 1) 4) . 1) (((0 2 0 0 1 0 1) 4) . -1)
  979. ) 5 0 nil)) nil nil)
  980. % This needs even more time than the eqhull, of course.
  981. u:=primarydecomposition!* n;
  982. (((dpmat 16 0 ((1 ((((0 0 2 1 0 1) 4) . 1) (((0 1 0 1 1 1) 4) . -1) (((0 0 3 0 0
  983. 0 1) 4) . -1) (((0 1 1 0 1 0 1) 4) . 1)) 4 0 nil) (2 ((((0 0 1 2 0 1) 4) . 1) ((
  984. (0 1 0 1 0 2) 4) . -1) (((0 0 2 1 0 0 1) 4) . -1) (((0 1 1 0 0 1 1) 4) . 1)) 4 0
  985. nil) (3 ((((0 0 1 1 0 2) 4) . 1) (((0 1 0 0 0 3) 4) . -1) (((0 0 1 1 1 0 1) 4) .
  986. -1) (((0 1 0 0 1 1 1) 4) . 1)) 4 0 nil) (4 ((((0 0 4) 4) . 1) (((0 1 2 0 1) 4) .
  987. -2) (((0 2 0 0 2) 4) . 1)) 3 0 nil) (5 ((((0 0 3 1) 4) . 1) (((0 1 1 1 1) 4) . -1
  988. ) (((0 1 2 0 0 1) 4) . -1) (((0 2 0 0 1 1) 4) . 1)) 4 0 nil) (6 ((((0 0 2 2) 4) .
  989. 1) (((0 1 1 1 0 1) 4) . -2) (((0 2 0 0 0 2) 4) . 1)) 3 0 nil) (7 ((((0 0 2 1 1) 4
  990. ) . 1) (((0 1 0 1 2) 4) . -1) (((0 0 3 0 0 1) 4) . -1) (((0 1 1 0 1 1) 4) . 1)) 4
  991. 0 nil) (8 ((((0 0 2 0 0 2) 4) . 1) (((0 1 0 0 1 2) 4) . -1) (((0 0 2 0 1 0 1) 4)
  992. . -1) (((0 1 0 0 2 0 1) 4) . 1)) 4 0 nil) (9 ((((0 0 0 4) 4) . 1) (((0 1 0 2 0 0
  993. 1) 4) . -2) (((0 2 0 0 0 0 2) 4) . 1)) 3 0 nil) (10 ((((0 0 0 0 0 4) 4) . 1) (((
  994. 0 0 0 0 1 2 1) 4) . -2) (((0 0 0 0 2 0 2) 4) . 1)) 3 0 nil) (11 ((((0 0 0 2 0 2)
  995. 4) . 1) (((0 0 1 1 0 1 1) 4) . -2) (((0 0 2 0 0 0 2) 4) . 1)) 3 0 nil) (12 ((((0
  996. 0 1 3) 4) . 1) (((0 1 0 2 0 1) 4) . -1) (((0 1 1 1 0 0 1) 4) . -1) (((0 2 0 0 0 1
  997. 1) 4) . 1)) 4 0 nil) (13 ((((0 0 0 3 0 1) 4) . 1) (((0 0 1 2 0 0 1) 4) . -1) (((
  998. 0 1 0 1 0 1 1) 4) . -1) (((0 1 1 0 0 0 2) 4) . 1)) 4 0 nil) (14 ((((0 0 0 1 1 2)
  999. 4) . 1) (((0 0 1 0 0 3) 4) . -1) (((0 0 0 1 2 0 1) 4) . -1) (((0 0 1 0 1 1 1) 4)
  1000. . 1)) 4 0 nil) (15 ((((0 0 0 1 0 3) 4) . 1) (((0 0 0 1 1 1 1) 4) . -1) (((0 0 1 0
  1001. 0 2 1) 4) . -1) (((0 0 1 0 1 0 2) 4) . 1)) 4 0 nil) (16 ((((0 0 0 2 1) 3) . 1) (
  1002. ((0 0 1 1 0 1) 3) . -2) (((0 1 0 0 0 2) 3) . 1) (((0 0 2 0 0 0 1) 3) . 1) (((0 1
  1003. 0 0 1 0 1) 3) . -1)) 5 0 nil)) nil t) (dpmat 6 0 ((1 ((((0 0 0 1 0 1) 2) . 1) ((
  1004. (0 0 1 0 0 0 1) 2) . -1)) 2 0 nil) (2 ((((0 0 0 0 0 2) 2) . 1) (((0 0 0 0 1 0 1)
  1005. 2) . -1)) 2 0 nil) (3 ((((0 0 0 1 1) 2) . 1) (((0 0 1 0 0 1) 2) . -1)) 2 0 nil) (
  1006. 4 ((((0 0 0 2) 2) . 1) (((0 1 0 0 0 0 1) 2) . -1)) 2 0 nil) (5 ((((0 0 1 1) 2) .
  1007. 1) (((0 1 0 0 0 1) 2) . -1)) 2 0 nil) (6 ((((0 0 2) 2) . 1) (((0 1 0 0 1) 2) . -1
  1008. )) 2 0 nil)) nil t)) ((dpmat 18 0 ((1 ((((0 0 1 0 0 3) 4) . 1)) 1 0 nil) (2 ((((
  1009. 0 0 0 0 0 0 1) 1) . 1)) 1 0 nil) (3 ((((0 0 0 4) 4) . 1)) 1 0 nil) (4 ((((0 0 0 0
  1010. 0 4) 4) . 1)) 1 0 nil) (5 ((((0 0 0 2 0 2) 4) . 1)) 1 0 nil) (6 ((((0 0 0 3 0 1)
  1011. 4) . 1)) 1 0 nil) (7 ((((0 0 0 1 0 3) 4) . 1)) 1 0 nil) (8 ((((0 0 0 0 1) 1) . 1
  1012. )) 1 0 nil) (9 ((((0 0 3 0 0 1) 4) . 1)) 1 0 nil) (10 ((((0 0 2 1 0 1) 4) . 1)) 1
  1013. 0 nil) (11 ((((0 0 1 2 0 1) 4) . 1)) 1 0 nil) (12 ((((0 0 2 0 0 2) 4) . 1)) 1 0
  1014. nil) (13 ((((0 0 1 1 0 2) 4) . 1)) 1 0 nil) (14 ((((0 0 4) 4) . 1)) 1 0 nil) (15
  1015. ((((0 0 2 2) 4) . 1)) 1 0 nil) (16 ((((0 1) 1) . 1)) 1 0 nil) (17 ((((0 0 1 3) 4
  1016. ) . 1)) 1 0 nil) (18 ((((0 0 3 1) 4) . 1)) 1 0 nil)) nil t) (dpmat 6 0 ((1 ((((0
  1017. 0 0 0 0 0 1) 1) . 1)) 1 0 nil) (2 ((((0 0 0 0 1) 1) . 1)) 1 0 nil) (3 ((((0 1) 1
  1018. ) . 1)) 1 0 nil) (4 ((((0 0 1) 1) . 1)) 1 0 nil) (5 ((((0 0 0 1) 1) . 1)) 1 0 nil
  1019. ) (6 ((((0 0 0 0 0 1) 1) . 1)) 1 0 nil)) nil t)))
  1020. for each x in u collect easydim!* cadr x;
  1021. (3 0)
  1022. for each x in u collect degree!* car x;
  1023. (16 20)
  1024. % Hence the embedded component is a trivial one. Let's divide
  1025. % it out by a stable ideal quotient calculation :
  1026. algebraic;
  1027. setideal(n2,matstabquot(n,vars));
  1028. {x2**4 - 2*x1*x2**2*x4 + x1**2*x4**2,
  1029. x3**4 - 2*x1*x3**2*x6 + x1**2*x6**2,
  1030. x5**4 - 2*x4*x5**2*x6 + x4**2*x6**2,
  1031. x2**2*x3**2 - 2*x1*x2*x3*x5 + x1**2*x5**2,
  1032. x3**2*x5**2 - 2*x2*x3*x5*x6 + x2**2*x6**2,
  1033. x2**3*x3 - x1*x2*x3*x4 - x1*x2**2*x5 + x1**2*x4*x5,
  1034. x2*x3**3 - x1*x3**2*x5 - x1*x2*x3*x6 + x1**2*x5*x6,
  1035. x2**2*x3*x4 - x1*x3*x4**2 - x2**3*x5 + x1*x2*x4*x5,
  1036. x2**2*x3*x5 - x1*x3*x4*x5 - x2**3*x6 + x1*x2*x4*x6,
  1037. x2*x3**2*x5 - x1*x3*x5**2 - x2**2*x3*x6 + x1*x2*x5*x6,
  1038. x3**3*x5 - x2*x3**2*x6 - x1*x3*x5*x6 + x1*x2*x6**2,
  1039. x2**2*x5**2 - x1*x4*x5**2 - x2**2*x4*x6 + x1*x4**2*x6,
  1040. x2*x3*x5**2 - x1*x5**3 - x2*x3*x4*x6 + x1*x4*x5*x6,
  1041. x3*x4*x5**2 - x2*x5**3 - x3*x4**2*x6 + x2*x4*x5*x6,
  1042. x3*x5**3 - x3*x4*x5*x6 - x2*x5**2*x6 + x2*x4*x6**2,
  1043. x3**2*x4 - 2*x2*x3*x5 + x1*x5**2 + x2**2*x6 - x1*x4*x6}$
  1044. modequalp(n1,n2);
  1045. yes$
  1046. comment
  1047. ########################################
  1048. ### ###
  1049. ### Test Examples for New Features ###
  1050. ### ###
  1051. ########################################
  1052. end comment;
  1053. % ==> Testing the different zerodimensional solver
  1054. vars:={x,y,z}$
  1055. setring(vars,degreeorder vars,revlex);
  1056. {{x,y,z},{{1,1,1}},revlex,{1,1,1}}$
  1057. setideal(m,{x^3+y+z-3,y^3+x+z-3,z^3+x+y-3});
  1058. {x**3 + y + z - 3,y**3 + x + z - 3,z**3 + x + y - 3}$
  1059. zerosolve1 m;
  1060. {{x + y + z**3 - 3,
  1061. y + z**3 + z - 3,
  1062. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8},
  1063. {x + y + z**3 - 3,
  1064. 2*y + z**3 - 3,
  1065. z**6 - 2*z**4 - 6*z**3 + 4*z**2 + 6*z + 5},
  1066. {x + y + z,
  1067. y**2 + y*z + z**2 - 1,
  1068. z**3 - z - 3},
  1069. {x + z**3 + z - 3,
  1070. y - z,
  1071. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8},
  1072. {x - z,y - z,z**2 + z + 3},
  1073. {x - 1,y - 1,z - 1}}$
  1074. zerosolve2 m;
  1075. {{x + y + z**3 - 3,
  1076. y + z**3 + z - 3,
  1077. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8},
  1078. {x + y + z**3 - 3,
  1079. 2*y + z**3 - 3,
  1080. z**6 - 2*z**4 - 6*z**3 + 4*z**2 + 6*z + 5},
  1081. {x + y + z,
  1082. y**2 + y*z + z**2 - 1,
  1083. z**3 - z - 3},
  1084. {x + z**3 + z - 3,
  1085. y - z,
  1086. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8},
  1087. {x - z,y - z,z**2 + z + 3},
  1088. {x - 1,y - 1,z - 1}}$
  1089. setring(vars,{},lex)$
  1090. setideal(m,m)$
  1091. m1:=gbasis m$
  1092. zerosolve m1;
  1093. {{x - 1,y - 1,z - 1},
  1094. {x - z,y - z,z**2 + z + 3},
  1095. {x + y + z,
  1096. y**2 + y*z + z**2 - 1,
  1097. z**3 - z - 3},
  1098. {2*x + z**3 - 3,
  1099. 2*y + z**3 - 3,
  1100. z**6 - 2*z**4 - 6*z**3 + 4*z**2 + 6*z + 5},
  1101. {x + z**3 + z - 3,
  1102. y - z,
  1103. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8},
  1104. {x - z,
  1105. y + z**3 + z - 3,
  1106. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8}}$
  1107. zerosolve1 m1;
  1108. {{x - 1,y - 1,z - 1},
  1109. {x - z,y - z,z**2 + z + 3},
  1110. {x + y + z,
  1111. y**2 + y*z + z**2 - 1,
  1112. z**3 - z - 3},
  1113. {x - y,
  1114. 2*y + z**3 - 3,
  1115. z**6 - 2*z**4 - 6*z**3 + 4*z**2 + 6*z + 5},
  1116. {x + z**3 + z - 3,
  1117. y - z,
  1118. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8},
  1119. {x - z,
  1120. y + z**3 + z - 3,
  1121. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8}}$
  1122. zerosolve2 m1;
  1123. {{x - 1,y - 1,z - 1},
  1124. {x - z,y - z,z**2 + z + 3},
  1125. {x + y + z,
  1126. y**2 + y*z + z**2 - 1,
  1127. z**3 - z - 3},
  1128. {x - y,
  1129. 2*y + z**3 - 3,
  1130. z**6 - 2*z**4 - 6*z**3 + 4*z**2 + 6*z + 5},
  1131. {x + z**3 + z - 3,
  1132. y - z,
  1133. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8},
  1134. {x - z,
  1135. y + z**3 + z - 3,
  1136. z**6 + z**4 - 6*z**3 + z**2 - 3*z + 8}}$
  1137. % ==> Testing groebfactor, extendedgroebfactor, extendedgroebfactor1
  1138. % Gerdt et al. : Seventh order KdV type equation.
  1139. A1:=-2*L1**2+L1*L2+2*L1*L3-L2**2-7*L5+21*L6$
  1140. A2:=7*L7-2*L1*L4+3/7*L1**3$
  1141. B1:=L1*(5*L1-3*L2+L3)$
  1142. B2:=L1*(2*L6-4*L4)$
  1143. B3:=L1*L7/2$
  1144. P1:=L1*(L4-L5/2+L6)$
  1145. P2:=(2/7*L1**2-L4)*(-10*L1+5*L2-L3)$
  1146. P3:=(2/7*L1**2-L4)*(3*L4-L5+L6)$
  1147. P4:=A1*(-3*L1+2*L2)+21*A2$
  1148. P5:=A1*(2*L4-2*L5)+A2*(-45*L1+15*L2-3*L3)$
  1149. P6:=2*A1*L7+A2*(12*L4-3*L5+2*L6)$
  1150. P7:=B1*(2*L2-L1)+7*B2$
  1151. P8:=B1*L3+7*B2$
  1152. P9:=B1*(-2*L4-2*L5)+B2*(2*L2-8*L1)+84*B3$
  1153. P10:=B1*(8/3*L5+6*L6)+B2*(11*L1-17/3*L2+5/3*L3)-168*B3$
  1154. P11:=15*B1*L7+B2*(5*L4-2*L5)+B3*(-120*L1+30*L2-6*L3)$
  1155. P12:=-3*B1*L7+B2*(-L4/2+L5/4-L6/2)+B3*(24*L1-6*L2)$
  1156. P13:=3*B2*L7+B3*(40*L4-8*L5+4*L6)$
  1157. polys:={P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13};
  1158. polys := {(l1*(2*l4 - l5 + 2*l6))/2,
  1159. ( - 20*l1**3 + 10*l1**2*l2 - 2*l1**2*l3 + 70*l1*l4 - 35*l2*l4 + 7*l3*l4)/7,
  1160. (6*l1**2*l4 - 2*l1**2*l5 + 2*l1**2*l6 - 21*l4**2 + 7*l4*l5 - 7*l4*l6)/7,
  1161. 15*l1**3 - 7*l1**2*l2 - 6*l1**2*l3 + 5*l1*l2**2 + 4*l1*l2*l3 - 42*l1*l4 + 21*l1*
  1162. l5 - 63*l1*l6 - 2*l2**3 - 14*l2*l5 + 42*l2*l6 + 147*l7,
  1163. ( - 135*l1**4 + 45*l1**3*l2 - 9*l1**3*l3 + 602*l1**2*l4 + 28*l1**2*l5 - 196*l1*
  1164. l2*l4 - 14*l1*l2*l5 + 70*l1*l3*l4 - 28*l1*l3*l5 - 2205*l1*l7 - 14*l2**2*l4 + 14*
  1165. l2**2*l5 + 735*l2*l7 - 147*l3*l7 - 98*l4*l5 + 294*l4*l6 + 98*l5**2 - 294*l5*l6)/
  1166. 7,
  1167. (36*l1**3*l4 - 9*l1**3*l5 + 6*l1**3*l6 - 28*l1**2*l7 + 14*l1*l2*l7 + 28*l1*l3*l7
  1168. - 168*l1*l4**2 + 42*l1*l4*l5 - 28*l1*l4*l6 - 14*l2**2*l7 + 588*l4*l7 - 245*l5*
  1169. l7 + 392*l6*l7)/7,
  1170. l1*( - 5*l1**2 + 13*l1*l2 - l1*l3 - 6*l2**2 + 2*l2*l3 - 28*l4 + 14*l6),
  1171. l1*(5*l1*l3 - 3*l2*l3 + l3**2 - 28*l4 + 14*l6),
  1172. 2*l1*(11*l1*l4 - 5*l1*l5 - 8*l1*l6 - l2*l4 + 3*l2*l5 + 2*l2*l6 - l3*l4 - l3*l5 +
  1173. 21*l7),
  1174. (4*l1*( - 33*l1*l4 + 10*l1*l5 + 39*l1*l6 + 17*l2*l4 - 6*l2*l5 - 22*l2*l6 - 5*l3*
  1175. l4 + 2*l3*l5 + 7*l3*l6 - 63*l7))/3,
  1176. l1*(15*l1*l7 - 30*l2*l7 + 12*l3*l7 - 20*l4**2 + 8*l4*l5 + 10*l4*l6 - 4*l5*l6),
  1177. (l1*( - 6*l1*l7 + 12*l2*l7 - 6*l3*l7 + 4*l4**2 - 2*l4*l5 + 2*l4*l6 + l5*l6 - 2*
  1178. l6**2))/2,
  1179. 4*l1*l7*(2*l4 - l5 + 2*l6)}$
  1180. vars:={L7,L6,L5,L4,L3,L2,L1};
  1181. vars := {l7,
  1182. l6,
  1183. l5,
  1184. l4,
  1185. l3,
  1186. l2,
  1187. l1}$
  1188. clear a1,a2,b1,b2,b3$
  1189. off lexefgb;
  1190. setring(vars,{},lex);
  1191. {{l7,l6,l5,l4,l3,l2,l1},{},lex,{1,1,1,1,1,1,1}}$
  1192. % The factorized Groebner algorithm.
  1193. groebfactor polys;
  1194. {{l1,l4,l7,21*l6 - 7*l5 - l2**2},
  1195. {l1,
  1196. l4,
  1197. 7*l5 - l3*l2 + 5*l2**2,
  1198. 56*l6 - 5*l3*l2 + 23*l2**2,
  1199. 588*l7 + 7*l3*l2**2 - 37*l2**3},
  1200. {l1,
  1201. l7,
  1202. l3 - 5*l2,
  1203. 14*l6 - 21*l4 - l2**2,
  1204. 14*l5 - 63*l4 - l2**2},
  1205. {l1,l4,l2,l5,l7},
  1206. {7*l4 - 2*l1**2,
  1207. l2 - 2*l1,
  1208. l3 - 3*l1,
  1209. 147*l7 - 4*l1**3,
  1210. 7*l5 - 6*l1**2,
  1211. 7*l6 - l1**2},
  1212. {7*l4 - 2*l1**2,
  1213. 2*l2 - 7*l1,
  1214. l3 - 6*l1,
  1215. 147*l7 - 4*l1**3,
  1216. 7*l5 - 9*l1**2,
  1217. 14*l6 - 5*l1**2},
  1218. {l1,
  1219. l3 - 5*l2,
  1220. 63*l4 + 2*l2**2,
  1221. 63*l5 + 2*l2**2,
  1222. 63*l6 - 4*l2**2,
  1223. 1323*l7 + 10*l2**3},
  1224. {l1,l2,l3,l7,l5 - l4,l6 + 2*l4},
  1225. {l2 - 3*l1,
  1226. l3 - 5*l1,
  1227. 14*l4 - 5*l1**2,
  1228. 98*l7 - 5*l1**3,
  1229. 7*l5 - 10*l1**2,
  1230. 14*l6 - 5*l1**2}}$
  1231. % The extended Groebner factorizer, producing triangular sets.
  1232. extendedgroebfactor polys;
  1233. {{{98*l7 - 5*l1**3,
  1234. 14*l6 - 5*l1**2,
  1235. 7*l5 - 10*l1**2,
  1236. 14*l4 - 5*l1**2,
  1237. l3 - 5*l1,
  1238. l2 - 3*l1},
  1239. {},
  1240. {l1}},
  1241. {{l7,l6 + 2*l4,l5 - l4,l3,l2,l1},{},{l4}},
  1242. {{1323*l7 + 10*l2**3,
  1243. 63*l6 - 4*l2**2,
  1244. 63*l5 + 2*l2**2,
  1245. 63*l4 + 2*l2**2,
  1246. l3 - 5*l2,
  1247. l1},
  1248. {},
  1249. {l2}},
  1250. {{147*l7 - 4*l1**3,
  1251. 14*l6 - 5*l1**2,
  1252. 7*l5 - 9*l1**2,
  1253. 7*l4 - 2*l1**2,
  1254. l3 - 6*l1,
  1255. 2*l2 - 7*l1},
  1256. {},
  1257. {l1}},
  1258. {{147*l7 - 4*l1**3,
  1259. 7*l6 - l1**2,
  1260. 7*l5 - 6*l1**2,
  1261. 7*l4 - 2*l1**2,
  1262. l3 - 3*l1,
  1263. l2 - 2*l1},
  1264. {},
  1265. {l1}},
  1266. {{l7,l5,l4,l2,l1},{},{l6,l3}},
  1267. {{l7,
  1268. 14*l6 - (l2**2 + 21*l4),
  1269. 14*l5 - (l2**2 + 63*l4),
  1270. l3 - 5*l2,
  1271. l1},
  1272. {},
  1273. {l4,l2}},
  1274. {{588*l7 - (37*l2**3 - 7*l2**2*l3),
  1275. 56*l6 + (23*l2**2 - 5*l2*l3),
  1276. 7*l5 + (5*l2**2 - l2*l3),
  1277. l4,
  1278. l1},
  1279. {},
  1280. {l3,l2}},
  1281. {{l7,21*l6 - (l2**2 + 7*l5),l4,l1},{},{l5,l3,l2}}}$
  1282. % The extended Groebner factorizer with subproblem removal check.
  1283. extendedgroebfactor1 polys;
  1284. {{{l7,21*l6 - (l2**2 + 7*l5),l4,l1},{},{l5,l3,l2}},
  1285. {{588*l7 - (37*l2**3 - 7*l2**2*l3),
  1286. 56*l6 + (23*l2**2 - 5*l2*l3),
  1287. 7*l5 + (5*l2**2 - l2*l3),
  1288. l4,
  1289. l1},
  1290. {},
  1291. {l3,l2}},
  1292. {{l7,
  1293. 14*l6 - (l2**2 + 21*l4),
  1294. 14*l5 - (l2**2 + 63*l4),
  1295. l3 - 5*l2,
  1296. l1},
  1297. {},
  1298. {l4,l2}},
  1299. {{l7,l5,l4,l2,l1},{},{l6,l3}},
  1300. {{147*l7 - 4*l1**3,
  1301. 7*l6 - l1**2,
  1302. 7*l5 - 6*l1**2,
  1303. 7*l4 - 2*l1**2,
  1304. l3 - 3*l1,
  1305. l2 - 2*l1},
  1306. {},
  1307. {l1}},
  1308. {{147*l7 - 4*l1**3,
  1309. 14*l6 - 5*l1**2,
  1310. 7*l5 - 9*l1**2,
  1311. 7*l4 - 2*l1**2,
  1312. l3 - 6*l1,
  1313. 2*l2 - 7*l1},
  1314. {},
  1315. {l1}},
  1316. {{1323*l7 + 10*l2**3,
  1317. 63*l6 - 4*l2**2,
  1318. 63*l5 + 2*l2**2,
  1319. 63*l4 + 2*l2**2,
  1320. l3 - 5*l2,
  1321. l1},
  1322. {},
  1323. {l2}},
  1324. {{l7,l6 + 2*l4,l5 - l4,l3,l2,l1},{},{l4}},
  1325. {{98*l7 - 5*l1**3,
  1326. 14*l6 - 5*l1**2,
  1327. 7*l5 - 10*l1**2,
  1328. 14*l4 - 5*l1**2,
  1329. l3 - 5*l1,
  1330. l2 - 3*l1},
  1331. {},
  1332. {l1}}}$
  1333. % Gonnet's example (ACM SIGSAM Bulletin 17 (1983), 48 - 49)
  1334. vars:={a0,a2,a3,a4,a5,b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5};
  1335. vars := {a0,
  1336. a2,
  1337. a3,
  1338. a4,
  1339. a5,
  1340. b0,
  1341. b1,
  1342. b2,
  1343. b3,
  1344. b4,
  1345. b5,
  1346. c0,
  1347. c1,
  1348. c2,
  1349. c3,
  1350. c4,
  1351. c5}$
  1352. polys:={a4*b4,
  1353. a5*b1+b5+a4*b3+a3*b4,
  1354. a2*b2,a5*b5,
  1355. (a0+1+a4)*b2+a2*(b0+b1+b4)+c2,
  1356. (a0+1+a4)*(b0+b1+b4)+(a3+a5)*b2+a2*(b3+b5)+c0+c1+c4,
  1357. (a3+a5)*(b0+b1+b4)+(b3+b5)*(a0+1+a4)+c3+c5-1,
  1358. (a3+a5)*(b3+b5),
  1359. a5*(b3+b5)+b5*(a3+a5),
  1360. b5*(a0+1+2*a4)+a5*(b0+b1+2*b4)+a3*b4+a4*b3+c5,
  1361. a4*(b0+b1+2*b4)+a2*b5+a5*b2+(a0+1)*b4+c4,
  1362. a2*b4+a4*b2,
  1363. a4*b5+a5*b4,
  1364. 2*a3*b3+a3*b5+a5*b3,
  1365. c3+b3*(a0+2+a4)+a3*(b0+2*b1+b4)+b5+a5*b1,
  1366. c1+(a0+2+a4)*b1+a2*b3+a3*b2+(b0+b4),
  1367. a2*b1+b2,
  1368. a5*b3+a3*b5,
  1369. b4+a4*b1};
  1370. polys := {a4*b4,
  1371. a3*b4 + a4*b3 + a5*b1 + b5,
  1372. a2*b2,
  1373. a5*b5,
  1374. a0*b2 + a2*b0 + a2*b1 + a2*b4 + a4*b2 + b2 + c2,
  1375. a0*b0 + a0*b1 + a0*b4 + a2*b3 + a2*b5 + a3*b2 + a4*b0 + a4*b1 + a4*b4 + a5*b2 +
  1376. b0 + b1 + b4 + c0 + c1 + c4,
  1377. a0*b3 + a0*b5 + a3*b0 + a3*b1 + a3*b4 + a4*b3 + a4*b5 + a5*b0 + a5*b1 + a5*b4 +
  1378. b3 + b5 + c3 + c5 - 1,
  1379. a3*b3 + a3*b5 + a5*b3 + a5*b5,
  1380. a3*b5 + a5*b3 + 2*a5*b5,
  1381. a0*b5 + a3*b4 + a4*b3 + 2*a4*b5 + a5*b0 + a5*b1 + 2*a5*b4 + b5 + c5,
  1382. a0*b4 + a2*b5 + a4*b0 + a4*b1 + 2*a4*b4 + a5*b2 + b4 + c4,
  1383. a2*b4 + a4*b2,
  1384. a4*b5 + a5*b4,
  1385. 2*a3*b3 + a3*b5 + a5*b3,
  1386. a0*b3 + a3*b0 + 2*a3*b1 + a3*b4 + a4*b3 + a5*b1 + 2*b3 + b5 + c3,
  1387. a0*b1 + a2*b3 + a3*b2 + a4*b1 + b0 + 2*b1 + b4 + c1,
  1388. a2*b1 + b2,
  1389. a3*b5 + a5*b3,
  1390. a4*b1 + b4}$
  1391. on lexefgb;
  1392. % Switching back to the default.
  1393. setring(vars,{},lex);
  1394. {{a0,a2,a3,a4,a5,b0,b1,b2,b3,b4,b5,c0,c1,c2,c3,c4,c5},
  1395. {},
  1396. lex,
  1397. {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}}$
  1398. groebfactor polys;
  1399. {{c5,
  1400. b5,
  1401. c2,
  1402. c4,
  1403. b2,
  1404. b4,
  1405. a4,
  1406. a2,
  1407. a5,
  1408. b3,
  1409. a3*b1 + 1,
  1410. b0 - b1*c3 + 2*b1,
  1411. a0 - a3*c1 + c3,
  1412. b1*c3**2 - 2*b1*c3 + b1 - c0 + c1*c3 - 2*c1,
  1413. a3*c0 - a3*c1*c3 + 2*a3*c1 + c3**2 - 2*c3 + 1},
  1414. {c5,
  1415. c4,
  1416. b5,
  1417. b4,
  1418. a4,
  1419. b2,
  1420. a5,
  1421. a3,
  1422. b1,
  1423. b3 + 1,
  1424. a0 - c3 + 2,
  1425. b0*c3 - 2*b0 + c0,
  1426. a2 - b0 - c1,
  1427. b0**2 + b0*c1 + c2,
  1428. b0*c0 + c0*c1 - c2*c3 + 2*c2,
  1429. c0**2 - c0*c1*c3 + 2*c0*c1 + c2*c3**2 - 4*c2*c3 + 4*c2},
  1430. {c5,
  1431. b5,
  1432. c2,
  1433. c4,
  1434. b2,
  1435. b4,
  1436. a4,
  1437. a2,
  1438. a5,
  1439. a3,
  1440. b3 + 1,
  1441. b0 + b1*c3 + c1,
  1442. a0 - c3 + 2,
  1443. b1*c3**2 - 2*b1*c3 + b1 - c0 + c1*c3 - 2*c1}}$
  1444. extendedgroebfactor polys;
  1445. {{{b1*a0 + (b1 + c1),
  1446. a2,
  1447. b1*a3 + 1,
  1448. a4,
  1449. a5,
  1450. b0 + b1,
  1451. b2,
  1452. b3,
  1453. b4,
  1454. b5,
  1455. c0 + c1,
  1456. c2,
  1457. c3 - 1,
  1458. c4,
  1459. c5},
  1460. {b1,b1},
  1461. {b1,c1}},
  1462. {{a0,
  1463. a2 - b0 - c1,
  1464. a3,
  1465. a4,
  1466. a5,
  1467. b0**2 + c1*b0 + c2,
  1468. b1,
  1469. b2,
  1470. b3 + 1,
  1471. b4,
  1472. b5,
  1473. c0,
  1474. c3 - 2,
  1475. c4,
  1476. c5},
  1477. {},
  1478. {c1,c2}},
  1479. {{a0 + 1,a2,a3,a4,a5,b0 + (b1 + c1),b2,b3 + 1,b4,b5,c0 + c1,c2,c3 - 1,c4,c5},
  1480. {},
  1481. {b1,c1}},
  1482. {{a0 - (c3 - 2),
  1483. a2,
  1484. a3,
  1485. a4,
  1486. a5,
  1487. (c3**2 - 2*c3 + 1)*b0 + (c0*c3 + c1),
  1488. (c3**2 - 2*c3 + 1)*b1 - (c0 - c1*c3 + 2*c1),
  1489. b2,
  1490. b3 + 1,
  1491. b4,
  1492. b5,
  1493. c2,
  1494. c4,
  1495. c5},
  1496. {c3**2 - 2*c3 + 1,c3**2 - 2*c3 + 1},
  1497. {c0,c1,c3}},
  1498. {{a0 - (c3 - 2),
  1499. (c3 - 2)*a2 + c0 - (c1*c3 - 2*c1),
  1500. a3,
  1501. a4,
  1502. a5,
  1503. (c3 - 2)*b0 + c0,
  1504. b1,
  1505. b2,
  1506. b3 + 1,
  1507. b4,
  1508. b5,
  1509. c0**2 - (c1*c3 - 2*c1)*c0 + (c2*c3**2 - 4*c2*c3 + 4*c2),
  1510. c4,
  1511. c5},
  1512. {c3 - 2,c3 - 2},
  1513. {c1,c2,c3}},
  1514. {{(c0 - c1*c3 + 2*c1)*a0 + (c0*c3 + c1),
  1515. a2,
  1516. (c0 - c1*c3 + 2*c1)*a3 + (c3**2 - 2*c3 + 1),
  1517. a4,
  1518. a5,
  1519. (c3**2 - 2*c3 + 1)*b0 - (c0*c3 - 2*c0 - c1*c3**2 + 4*c1*c3 - 4*c1),
  1520. (c3**2 - 2*c3 + 1)*b1 - (c0 - c1*c3 + 2*c1),
  1521. b2,
  1522. b3,
  1523. b4,
  1524. b5,
  1525. c2,
  1526. c4,
  1527. c5},
  1528. {c0 - c1*c3 + 2*c1,
  1529. c0 - c1*c3 + 2*c1,
  1530. c3**2 - 2*c3 + 1,
  1531. c3**2 - 2*c3 + 1},
  1532. {c0,c1,c3}}}$
  1533. extendedgroebfactor1 polys;
  1534. {{{(c0 - c1*c3 + 2*c1)*a0 + (c0*c3 + c1),
  1535. a2,
  1536. (c0 - c1*c3 + 2*c1)*a3 + (c3**2 - 2*c3 + 1),
  1537. a4,
  1538. a5,
  1539. (c3**2 - 2*c3 + 1)*b0 - (c0*c3 - 2*c0 - c1*c3**2 + 4*c1*c3 - 4*c1),
  1540. (c3**2 - 2*c3 + 1)*b1 - (c0 - c1*c3 + 2*c1),
  1541. b2,
  1542. b3,
  1543. b4,
  1544. b5,
  1545. c2,
  1546. c4,
  1547. c5},
  1548. {c0 - c1*c3 + 2*c1,
  1549. c0 - c1*c3 + 2*c1,
  1550. c3**2 - 2*c3 + 1,
  1551. c3**2 - 2*c3 + 1},
  1552. {c0,c1,c3}},
  1553. {{a0 - (c3 - 2),
  1554. (c3 - 2)*a2 + c0 - (c1*c3 - 2*c1),
  1555. a3,
  1556. a4,
  1557. a5,
  1558. (c3 - 2)*b0 + c0,
  1559. b1,
  1560. b2,
  1561. b3 + 1,
  1562. b4,
  1563. b5,
  1564. c0**2 - (c1*c3 - 2*c1)*c0 + (c2*c3**2 - 4*c2*c3 + 4*c2),
  1565. c4,
  1566. c5},
  1567. {c3 - 2,c3 - 2},
  1568. {c1,c2,c3}},
  1569. {{a0 - (c3 - 2),
  1570. a2,
  1571. a3,
  1572. a4,
  1573. a5,
  1574. (c3**2 - 2*c3 + 1)*b0 + (c0*c3 + c1),
  1575. (c3**2 - 2*c3 + 1)*b1 - (c0 - c1*c3 + 2*c1),
  1576. b2,
  1577. b3 + 1,
  1578. b4,
  1579. b5,
  1580. c2,
  1581. c4,
  1582. c5},
  1583. {c3**2 - 2*c3 + 1,c3**2 - 2*c3 + 1},
  1584. {c0,c1,c3}}}$
  1585. % Schwarz' example s5
  1586. vars:=for k:=1:5 collect mkid(x,k);
  1587. vars := {x1,
  1588. x2,
  1589. x3,
  1590. x4,
  1591. x5}$
  1592. s5:={
  1593. x1**2+x1+2*x2*x5+2*x3*x4,
  1594. 2*x1*x2+x2+2*x3*x5+x4**2,
  1595. 2*x1*x3+x2**2+x3+2*x4*x5,
  1596. 2*x1*x4+2*x2*x3+x4+x5**2,
  1597. 2*x1*x5+2*x2*x4+x3**2+x5};
  1598. s5 := {x1**2 + x1 + 2*x2*x5 + 2*x3*x4,
  1599. 2*x1*x2 + x2 + 2*x3*x5 + x4**2,
  1600. 2*x1*x3 + x2**2 + x3 + 2*x4*x5,
  1601. 2*x1*x4 + 2*x2*x3 + x4 + x5**2,
  1602. 2*x1*x5 + 2*x2*x4 + x3**2 + x5}$
  1603. setring(vars,degreeorder vars,revlex);
  1604. {{x1,x2,x3,x4,x5},{{1,1,1,1,1}},revlex,{1,1,1,1,1}}$
  1605. m:=groebfactor s5;
  1606. m := {{x1**2 + 2*x3*x4 + 2*x2*x5 + x1,
  1607. 2*x1*x2 + x4**2 + 2*x3*x5 + x2,
  1608. x2**2 + 2*x1*x3 + 2*x4*x5 + x3,
  1609. 2*x2*x3 + 2*x1*x4 + x5**2 + x4,
  1610. x3**2 + 2*x2*x4 + 2*x1*x5 + x5,
  1611. 2*x1*x3*x4 + 2*x4**2*x5 + x3*x5**2 + x3*x4,
  1612. 5*x4**3 + 30*x3*x4*x5 + 15*x2*x5**2 - 2*x5,
  1613. 10*x3*x4**2 - 10*x1*x5**2 - 5*x5**2 - x4,
  1614. 625*x4*x5**3 + 50*x3*x4 + 75*x2*x5 - 6,
  1615. 15*x2*x4**2 + 30*x1*x4*x5 + 5*x5**3 + 15*x4*x5 + x3,
  1616. 100*x1*x4*x5**2 + 25*x5**4 + 50*x4*x5**2 + x4**2 + 4*x3*x5,
  1617. 1250*x1*x3*x5**2 + 625*x3*x5**2 - 75*x3*x4 - 50*x2*x5 + 8,
  1618. 75*x4**2*x5**2 + 50*x3*x5**3 + x2*x4 + 4*x1*x5 + 2*x5,
  1619. 150*x3*x4*x5**2 + 100*x2*x5**3 - 2*x1*x4 - 13*x5**2 - x4,
  1620. 625*x2*x5**4 - 50*x1*x4*x5 - 75*x5**3 - 25*x4*x5 - x3,
  1621. 1250*x3*x5**4 - 200*x2*x4*x5 - 50*x1*x5**2 - 25*x5**2 + 3*x4,
  1622. 625*x5**5 + 375*x4**2*x5 + 500*x3*x5**2 + 24*x1 + 12,
  1623. 10*x1*x4**2 + 20*x1*x3*x5 + 20*x4*x5**2 + 5*x4**2 + 10*x3*x5 + x2,
  1624. 75*x2*x4*x5**2 + 50*x1*x5**3 + 25*x5**3 - 2*x1*x3 - 3*x4*x5 - x3,
  1625. 1250*x1*x5**4 + 625*x5**4 + 100*x1*x3*x5 + 150*x4*x5**2 + 50*x3*x5 + 3*x2},
  1626. {x5,x2,x4,x3,x1},
  1627. {x5,x2,x4,x3,x1 + 1}}$
  1628. % Recompute a list of problems with listgroebfactor for another term
  1629. % order.
  1630. setring(vars,{},lex);
  1631. {{x1,x2,x3,x4,x5},{},lex,{1,1,1,1,1}}$
  1632. listgroebfactor m;
  1633. {{5*x5 - 1,
  1634. 5*x4 - 1,
  1635. 5*x1 + 4,
  1636. 5*x2 - 1,
  1637. 5*x3 - 1},
  1638. {5*x5 + 1,
  1639. 5*x4 + 1,
  1640. 5*x1 + 1,
  1641. 5*x2 + 1,
  1642. 5*x3 + 1},
  1643. {5*x1 + 2,
  1644. x2 - x5,
  1645. 25*x5**2 - 5*x5 - 1,
  1646. 5*x4 + 5*x5 - 1,
  1647. 5*x3 + 5*x5 - 1},
  1648. {5*x1 + 3,
  1649. x2 - x5,
  1650. 25*x5**2 + 5*x5 - 1,
  1651. 5*x4 + 5*x5 + 1,
  1652. 5*x3 + 5*x5 + 1},
  1653. {5*x1 + 3,
  1654. 5*x4 - 25*x5**2 + 10*x5 - 2,
  1655. x3 - 25*x5**3 + 15*x5**2 - 3*x5,
  1656. 5*x2 + 125*x5**3 - 50*x5**2 + 10*x5 - 1,
  1657. 625*x5**4 - 375*x5**3 + 100*x5**2 - 10*x5 + 1},
  1658. {5*x1 + 2,
  1659. 5*x2 + 5*x5 - 1,
  1660. 5*x4 - 250*x5**3 + 75*x5**2 - 30*x5 + 2,
  1661. 5*x3 + 250*x5**3 - 75*x5**2 + 30*x5 - 3,
  1662. 625*x5**4 - 250*x5**3 + 100*x5**2 - 15*x5 + 1},
  1663. {x4 + 5*x5**2,
  1664. 5*x1 + 1,
  1665. x3 - 25*x5**3,
  1666. 5*x2 + 125*x5**3 - 25*x5**2 + 5*x5 - 1,
  1667. 625*x5**4 - 125*x5**3 + 25*x5**2 - 5*x5 + 1},
  1668. {x4 - 5*x5**2,
  1669. 5*x1 + 4,
  1670. x3 - 25*x5**3,
  1671. 5*x2 + 125*x5**3 + 25*x5**2 + 5*x5 + 1,
  1672. 625*x5**4 + 125*x5**3 + 25*x5**2 + 5*x5 + 1},
  1673. {5*x1 + 3,
  1674. 5*x2 + 5*x5 + 1,
  1675. 5*x4 - 250*x5**3 - 75*x5**2 - 30*x5 - 2,
  1676. 5*x3 + 250*x5**3 + 75*x5**2 + 30*x5 + 3,
  1677. 625*x5**4 + 250*x5**3 + 100*x5**2 + 15*x5 + 1},
  1678. {5*x1 + 2,
  1679. 5*x4 + 25*x5**2 + 10*x5 + 2,
  1680. x3 - 25*x5**3 - 15*x5**2 - 3*x5,
  1681. 5*x2 + 125*x5**3 + 50*x5**2 + 10*x5 + 1,
  1682. 625*x5**4 + 375*x5**3 + 100*x5**2 + 10*x5 + 1},
  1683. {x5,
  1684. x2,
  1685. x4,
  1686. x3,
  1687. x1 + 1},
  1688. {x5,
  1689. x2,
  1690. x4,
  1691. x3,
  1692. x1}}$
  1693. % ==> Testing the linear algebra package
  1694. % Find the ideal of points in affine and projective space.
  1695. vars:=for k:=1:6 collect mkid(x,k);
  1696. vars := {x1,
  1697. x2,
  1698. x3,
  1699. x4,
  1700. x5,
  1701. x6}$
  1702. setring(vars,degreeorder vars,revlex);
  1703. {{x1,x2,x3,x4,x5,x6},{{1,1,1,1,1,1}},revlex,{1,1,1,1,1,1}}$
  1704. matrix mm(10,6);
  1705. on rounded;
  1706. for k:=1:6 do for l:=1:10 do mm(l,k):=floor(exp((k+l)/4));
  1707. off rounded;
  1708. mm;
  1709. mat((1,2,2,3,4,5),(2,2,3,4,5,7),(2,3,4,5,7,9),(3,4,5,7,9,12),(4,5,7,9,12,15),(5,
  1710. 7,9,12,15,20),(7,9,12,15,20,25),(9,12,15,20,25,33),(12,15,20,25,33,42),(15,20,25
  1711. ,33,42,54))$
  1712. setideal(u,affine_points mm);
  1713. {48337*x5**2 - 318*x4*x6 - 75336*x5*x6 + 29579*x6**2 - 11598*x1 - 11016*x2 -
  1714. 11352*x3 - 2502*x4 + 18371*x5 - 1837*x6 - 1836,
  1715. 386696*x1*x6 + 175678*x4*x6 + 20108*x5*x6 - 233347*x6**2 - 5821074*x1 - 831000*
  1716. x2 + 1382952*x3 + 741984*x4 - 2153934*x5 + 2692351*x6 - 1491936,
  1717. 386696*x3*x6 + 239238*x4*x6 - 185716*x5*x6 - 182039*x6**2 - 270738*x1 - 1255800*
  1718. x2 - 5052384*x3 - 2106864*x4 + 2351946*x5 + 2434483*x6 - 1562736,
  1719. 48337*x4**2 - 58746*x4*x6 + 148*x5*x6 + 17725*x6**2 + 2502*x1 + 576*x2 - 1302*x3
  1720. + 25721*x4 - 3488*x5 - 12857*x6 + 96,
  1721. 193348*x4*x5 - 151394*x4*x6 - 118604*x5*x6 + 92869*x6**2 + 1590*x1 + 8712*x2 +
  1722. 16560*x3 - 3708*x4 + 43918*x5 - 43409*x6 + 1452,
  1723. 386696*x2*x6 - 382090*x4*x6 - 43364*x5*x6 + 123645*x6**2 - 1313130*x1 - 4809120*
  1724. x2 + 91464*x3 + 5853096*x4 + 1118658*x5 - 2323361*x6 - 28128,
  1725. 193348*x6**3 - 78919578*x4*x6 - 63413004*x5*x6 + 81565689*x6**2 + 1412352942*x1
  1726. + 1563160200*x2 + 761482008*x3 + 10324224*x4 + 304232130*x5 - 1255484065*x6 -
  1727. 643375200,
  1728. 193348*x1*x4 - 3606*x4*x6 + 6664*x5*x6 - 36689*x6**2 - 1729374*x1 - 256248*x2 +
  1729. 422132*x3 + 345556*x4 - 671778*x5 + 747089*x6 - 429404,
  1730. 193348*x3*x4 - 19782*x4*x6 - 57060*x5*x6 + 1407*x6**2 - 86718*x1 - 378840*x2 -
  1731. 1475924*x3 - 576996*x4 + 715078*x5 + 671885*x6 - 449836,
  1732. 386696*x1*x5 + 139942*x4*x6 - 99156*x5*x6 - 94107*x6**2 - 4388370*x1 - 668088*x2
  1733. + 1063040*x3 + 468112*x4 - 1464774*x5 + 1964239*x6 - 1078088,
  1734. 386696*x3*x5 + 184150*x4*x6 - 329484*x5*x6 + 3733*x6**2 - 302634*x1 - 1062840*x2
  1735. - 3845096*x3 - 1562608*x4 + 1956858*x5 + 1752663*x6 - 1143880,
  1736. 193348*x1**2 + 50726*x4*x6 + 4164*x5*x6 - 49995*x6**2 - 1502518*x1 - 234624*x2 +
  1737. 337000*x3 + 189344*x4 - 544926*x5 + 709519*x6 - 425800,
  1738. 193348*x1*x2 - 22834*x4*x6 - 3056*x5*x6 - 4123*x6**2 - 1183010*x1 - 780060*x2 +
  1739. 282940*x3 + 989552*x4 - 238902*x5 + 102179*x6 - 226684,
  1740. 386696*x1*x3 + 153254*x4*x6 - 46332*x5*x6 - 109011*x6**2 - 2706290*x1 - 776040*
  1741. x2 - 650592*x3 - 288096*x4 - 295470*x5 + 1856303*x6 - 1096080,
  1742. 96674*x3**2 + 56278*x4*x6 - 44916*x5*x6 - 20423*x6**2 - 85218*x1 - 315900*x2 -
  1743. 1104614*x3 - 478348*x4 + 559514*x5 + 528787*x6 - 342672,
  1744. 193348*x2*x4 - 186922*x4*x6 - 13484*x5*x6 + 80823*x6**2 - 400398*x1 - 1437268*x2
  1745. + 32400*x3 + 1825348*x4 + 346526*x5 - 749039*x6 - 13972,
  1746. 386696*x2*x5 - 299774*x4*x6 - 183476*x5*x6 + 214259*x6**2 - 1032390*x1 - 3818088
  1747. *x2 + 38568*x3 + 4563624*x4 + 1175646*x5 - 2005927*x6 - 56304,
  1748. 193348*x5*x6**2 - 59111766*x4*x6 - 58092824*x5*x6 + 68856463*x6**2 + 1134803514*
  1749. x1 + 1224865560*x2 + 591403776*x3 - 36549312*x4 + 316517430*x5 - 1023460331*x6 -
  1750. 498675720,
  1751. 96674*x2**2 - 69590*x4*x6 - 7908*x5*x6 + 35327*x6**2 - 243426*x1 - 832910*x2 +
  1752. 14700*x3 + 1041208*x4 + 204662*x5 - 420851*x6 - 26032,
  1753. 386696*x2*x3 - 95202*x4*x6 - 92692*x5*x6 + 63421*x6**2 - 736122*x1 - 2670472*x2
  1754. - 1669344*x3 + 2061800*x4 + 1466002*x5 - 394913*x6 - 509528,
  1755. 96674*x4*x6**2 - 29277416*x4*x6 - 19752504*x5*x6 + 28388673*x6**2 + 433544670*x1
  1756. + 473916360*x2 + 235723620*x3 + 39729120*x4 + 97903830*x5 - 411516489*x6 -
  1757. 188800920}$
  1758. setgbasis u$
  1759. dim u;
  1760. 0$
  1761. degree u;
  1762. 10$
  1763. setideal(u,proj_points mm);
  1764. {457380*x5**3 - 13500*x2*x5*x6 - 20835*x3*x5*x6 + 76950*x4*x5*x6 - 1050234*x5**2
  1765. *x6 + 100*x1*x6**2 + 10800*x2*x6**2 + 16568*x3*x6**2 - 60271*x4*x6**2 + 771366*
  1766. x5*x6**2 - 179875*x6**3,
  1767. 330*x4**2 + 1665*x2*x5 + 555*x3*x5 - 4337*x4*x5 - 626*x5**2 + 6*x1*x6 - 1332*x2*
  1768. x6 - 450*x3*x6 + 3013*x4*x6 + 2740*x5*x6 - 1635*x6**2,
  1769. 33*x1*x5 - 90*x2*x5 - 63*x3*x5 + 216*x4*x5 + 60*x5**2 - 25*x1*x6 + 72*x2*x6 + 49
  1770. *x3*x6 - 170*x4*x6 - 171*x5*x6 + 97*x6**2,
  1771. 90*x3**2 - 483*x2*x5 - 183*x3*x5 + 1197*x4*x5 + 174*x5**2 - 2*x1*x6 + 384*x2*x6
  1772. + 68*x3*x6 - 937*x4*x6 - 738*x5*x6 + 485*x6**2,
  1773. 330*x3*x4 + 555*x2*x5 + 75*x3*x5 - 1519*x4*x5 - 172*x5**2 + 2*x1*x6 - 444*x2*x6
  1774. - 260*x3*x6 + 1041*x4*x6 + 950*x5*x6 - 545*x6**2,
  1775. 457380*x4*x5**2 - 10800*x2*x5*x6 - 9045*x3*x5*x6 - 662625*x4*x5*x6 - 265413*x5**
  1776. 2*x6 + 80*x1*x6**2 + 8640*x2*x6**2 + 7156*x3*x6**2 + 238408*x4*x6**2 + 391452*x5
  1777. *x6**2 - 143900*x6**3,
  1778. 495*x1*x2 + 1977*x2*x5 + 87*x3*x5 - 4824*x4*x5 - 339*x5**2 - 164*x1*x6 - 1707*x2
  1779. *x6 - 97*x3*x6 + 3782*x4*x6 + 2697*x5*x6 - 1840*x6**2,
  1780. 495*x2**2 + 1134*x2*x5 + 939*x3*x5 - 3771*x4*x5 - 822*x5**2 - 4*x1*x6 - 1257*x2*
  1781. x6 - 734*x3*x6 + 2956*x4*x6 + 2709*x5*x6 - 1550*x6**2,
  1782. 990*x1*x3 - 5043*x2*x5 - 1263*x3*x5 + 12321*x4*x5 + 1866*x5**2 - 464*x1*x6 +
  1783. 4008*x2*x6 + 788*x3*x6 - 9643*x4*x6 - 7968*x5*x6 + 5165*x6**2,
  1784. 495*x2*x3 + 1242*x2*x5 - 48*x3*x5 - 3555*x4*x5 - 267*x5**2 + 4*x1*x6 - 1218*x2*
  1785. x6 - 157*x3*x6 + 2786*x4*x6 + 2142*x5*x6 - 1420*x6**2,
  1786. 66*x1*x4 + 345*x2*x5 + 93*x3*x5 - 861*x4*x5 - 120*x5**2 - 38*x1*x6 - 276*x2*x6 -
  1787. 76*x3*x6 + 659*x4*x6 + 540*x5*x6 - 337*x6**2,
  1788. 495*x2*x4 + 1770*x2*x5 + 645*x3*x5 - 4908*x4*x5 - 729*x5**2 + 4*x1*x6 - 1713*x2*
  1789. x6 - 520*x3*x6 + 3677*x4*x6 + 3165*x5*x6 - 1915*x6**2,
  1790. 152460*x3*x5**2 + 5880*x2*x5*x6 - 237983*x3*x5*x6 - 6896*x4*x5*x6 - 71438*x5**2*
  1791. x6 + 64*x1*x6**2 - 4704*x2*x6**2 + 92748*x3*x6**2 + 5427*x4*x6**2 + 113560*x5*x6
  1792. **2 - 45061*x6**3,
  1793. 990*x1**2 - 1893*x2*x5 + 447*x3*x5 + 3771*x4*x5 + 426*x5**2 - 524*x1*x6 + 1488*
  1794. x2*x6 - 322*x3*x6 - 2923*x4*x6 - 2478*x5*x6 + 1715*x6**2,
  1795. 457380*x2*x5**2 - 754524*x2*x5*x6 - 31530*x3*x5*x6 + 156561*x4*x5*x6 - 132597*x5
  1796. **2*x6 + 136*x1*x6**2 + 310896*x2*x6**2 + 25088*x3*x6**2 - 122581*x4*x6**2 +
  1797. 141732*x5*x6**2 - 30097*x6**3}$
  1798. setgbasis u$
  1799. dim u;
  1800. 1$
  1801. degree u;
  1802. 10$
  1803. % Change the term order to pure lex in dimension zero.
  1804. % Test both approaches, with and without precomputed borderbasis.
  1805. vars:=for k:=1:6 collect mkid(x,k);
  1806. vars := {x1,
  1807. x2,
  1808. x3,
  1809. x4,
  1810. x5,
  1811. x6}$
  1812. r1:=setring(vars,{},lex);
  1813. r1 := {{x1,x2,x3,x4,x5,x6},{},lex,{1,1,1,1,1,1}}$
  1814. r2:=setring(vars,degreeorder vars,revlex);
  1815. r2 := {{x1,x2,x3,x4,x5,x6},{{1,1,1,1,1,1}},revlex,{1,1,1,1,1,1}}$
  1816. setideal(m,{x1**2+x1+2*x2*x6+2*x3*x5+x4**2,
  1817. 2*x1*x2+x2+2*x3*x6+2*x4*x5,
  1818. 2*x1*x3+x2**2+x3+2*x4*x6+x5**2,
  1819. 2*x1*x4+2*x2*x3+x4+2*x5*x6,
  1820. 2*x1*x5+2*x2*x4+x3**2+x5+x6**2,
  1821. 2*x1*x6+2*x2*x5+2*x3*x4+x6});
  1822. {x1**2 + x4**2 + 2*x3*x5 + 2*x2*x6 + x1,
  1823. 2*x1*x2 + 2*x4*x5 + 2*x3*x6 + x2,
  1824. x2**2 + 2*x1*x3 + x5**2 + 2*x4*x6 + x3,
  1825. 2*x2*x3 + 2*x1*x4 + 2*x5*x6 + x4,
  1826. x3**2 + 2*x2*x4 + 2*x1*x5 + x6**2 + x5,
  1827. 2*x3*x4 + 2*x2*x5 + 2*x1*x6 + x6}$
  1828. gbasis m;
  1829. {72*x1*x3*x5*x6 + 36*x3*x5*x6 - 2*x1*x6 - x6,
  1830. 2*x1*x2 + 2*x4*x5 + 2*x3*x6 + x2,
  1831. 2*x2*x3 + 2*x1*x4 + 2*x5*x6 + x4,
  1832. 2*x3*x4 + 2*x2*x5 + 2*x1*x6 + x6,
  1833. 10368*x6**7 + 5040*x4*x6**4 + 140*x4**2*x6 + 252*x2*x6**2 - 15*x6,
  1834. 1296*x4*x6**5 + 180*x4**2*x6**2 + 180*x2*x6**3 + 4*x2*x4 - 15*x6**2,
  1835. 2592*x3*x6**5 - 360*x2*x5*x6**2 + 2*x1*x4 + 12*x5*x6 + x4,
  1836. 72*x3*x5**2*x6 + 72*x2*x5*x6**2 - 2*x1*x4 - 8*x5*x6 - x4,
  1837. 36*x2*x5**3 - 108*x1*x4*x6**2 - 72*x5*x6**3 - 54*x4*x6**2 - 5*x3*x6,
  1838. 18*x4**2*x5 + 18*x3*x5**2 - 18*x1*x6**2 - 9*x6**2 - 2*x5,
  1839. 36*x4*x5**2 + 36*x4**2*x6 + 72*x3*x5*x6 + 36*x2*x6**2 - 5*x6,
  1840. x1**2 + x4**2 + 2*x3*x5 + 2*x2*x6 + x1,
  1841. x2**2 + 2*x1*x3 + x5**2 + 2*x4*x6 + x3,
  1842. x3**2 + 2*x2*x4 + 2*x1*x5 + x6**2 + x5,
  1843. 2592*x5*x6**5 + 360*x4*x5*x6**2 + 360*x3*x6**3 - 2*x2*x5 + 10*x1*x6 + 5*x6,
  1844. 2592*x5**2*x6**3 + 1296*x4*x6**4 + 36*x4**2*x6 + 144*x3*x5*x6 + 180*x2*x6**2 -
  1845. 13*x6,
  1846. 72*x5**3*x6 + 216*x4*x5*x6**2 + 72*x3*x6**3 + 2*x2*x5 + 6*x1*x6 + 3*x6,
  1847. 4*x4**3 - 12*x2*x5**2 - 24*x1*x5*x6 - 4*x6**3 - 12*x5*x6 - x4,
  1848. 12*x2*x4**2 - 24*x1*x3*x6 - 12*x5**2*x6 - 12*x4*x6**2 - 12*x3*x6 - x2,
  1849. 1296*x1*x6**5 + 648*x6**5 + 180*x1*x4*x6**2 + 180*x5*x6**3 + 90*x4*x6**2 + x4*x5
  1850. + 6*x3*x6,
  1851. 2592*x2*x6**5 + 360*x2*x4*x6**2 - 180*x6**4 - 6*x1*x3 - 3*x5**2 - 16*x4*x6 - 3*
  1852. x3,
  1853. 72*x3*x5*x6**3 + 36*x2*x6**4 - x2*x5**2 - 4*x2*x4*x6 - 4*x1*x5*x6 - 6*x6**3 - 2*
  1854. x5*x6,
  1855. 648*x4*x5*x6**3 + 324*x3*x6**4 - 9*x3*x5**2 - 18*x2*x5*x6 + 18*x1*x6**2 + 9*x6**
  1856. 2 + x5,
  1857. 2592*x1*x3*x6**3 + 1296*x4*x6**4 + 1296*x3*x6**3 - 36*x4**2*x6 - 72*x3*x5*x6 +
  1858. 36*x2*x6**2 + 5*x6,
  1859. 1080*x2*x4*x6**3 + 216*x6**5 - 60*x1*x3*x6 - 30*x5**2*x6 - 90*x4*x6**2 - 30*x3*
  1860. x6 - x2,
  1861. 72*x4**2*x6**3 + 36*x2*x6**4 + 3*x2*x5**2 + 8*x2*x4*x6 + 6*x1*x5*x6 - 2*x6**3 +
  1862. 3*x5*x6,
  1863. 36*x1*x5**2*x6 + 36*x1*x4*x6**2 + 36*x5*x6**3 + 18*x5**2*x6 + 18*x4*x6**2 + x4*
  1864. x5 + 2*x3*x6,
  1865. 18*x1*x5**3 - 54*x1*x3*x6**2 - 36*x4*x6**3 + 9*x5**3 - 27*x3*x6**2 + x3*x5 - 2*
  1866. x2*x6,
  1867. 18*x1*x4*x5 + 18*x1*x3*x6 + 18*x5**2*x6 + 18*x4*x6**2 + 9*x4*x5 + 9*x3*x6 + x2,
  1868. 18*x2*x4*x5 + 18*x1*x5**2 + 18*x1*x4*x6 + 18*x5*x6**2 + 9*x5**2 + 9*x4*x6 + x3,
  1869. 2*x1*x4**2 + 4*x1*x3*x5 + 2*x5**3 + 8*x4*x5*x6 + 2*x3*x6**2 + x4**2 + 2*x3*x5,
  1870. 72*x1*x4*x6**3 + 36*x5*x6**4 + 36*x4*x6**3 - 2*x1*x3*x5 - x5**3 - 2*x4*x5*x6 + 2
  1871. *x3*x6**2 - x3*x5,
  1872. 3240*x1*x5*x6**3 + 648*x6**5 + 1620*x5*x6**3 + 90*x1*x3*x6 + 90*x5**2*x6 + 180*
  1873. x4*x6**2 + 45*x3*x6 + 2*x2,
  1874. 72*x2*x5**2*x6 + 72*x2*x4*x6**2 + 144*x1*x5*x6**2 + 36*x6**4 + 72*x5*x6**2 - 2*
  1875. x1*x3 - x5**2 - x3,
  1876. 36*x5**4 - 216*x4**2*x6**2 - 432*x3*x5*x6**2 - 288*x2*x6**3 + 2*x2*x4 + 8*x1*x5
  1877. + 39*x6**2 + 4*x5,
  1878. 72*x3*x5**3 - 216*x1*x5*x6**2 - 36*x6**4 - 108*x5*x6**2 - 2*x1*x3 - 9*x5**2 - 8*
  1879. x4*x6 - x3,
  1880. 1296*x2*x5*x6**3 + 648*x1*x6**4 + 324*x6**4 - 18*x1*x5**2 - 36*x1*x4*x6 - 72*x5*
  1881. x6**2 - 9*x5**2 - 18*x4*x6 - x3,
  1882. 18*x1*x3*x5**2 + 18*x4**2*x6**2 + 54*x3*x5*x6**2 + 36*x2*x6**3 + 9*x3*x5**2 - x2
  1883. *x4 - 2*x1*x5 - 5*x6**2 - x5}$
  1884. m1:=change_termorder(m,r1);
  1885. m1 := {46656*x4*x5*x6**6 - x4*x5,
  1886. 80621568*x5*x6**13 + 44928*x5*x6**7 - x5*x6,
  1887. 637*x2 + 1077507256320*x6**17 - 927987840*x6**11 - 806157*x6**5,
  1888. 7*x4**2*x5 + 252*x4*x5*x6**3 - 30233088*x5*x6**12 - 17496*x5*x6**6,
  1889. 58773123072*x6**19 - 47869056*x6**13 - 45657*x6**7 + x6,
  1890. 2*x1*x4 + x4 + 1296*x5**3*x6**3 + 3*x5*x6,
  1891. 2548*x4**2*x6 + 91728*x4*x6**4 + 362797056*x6**13 - 33696*x6**7 - 141*x6,
  1892. 8491392*x4*x6**7 - 182*x4*x6 + 19591041024*x6**16 + 10917504*x6**10 - 243*x6**4,
  1893. 17199*x5**4*x6 + 1238328*x5**2*x6**5 + 4353564672*x6**15 - 5003856*x6**9 - 1328*
  1894. x6**3,
  1895. 4245696*x5**2*x6**7 - 91*x5**2*x6 + 8707129344*x6**17 - 12130560*x6**11 + 256*x6
  1896. **5,
  1897. 7*x3 - 567*x5**5 - 204120*x5**3*x6**4 + 524880*x5*x6**8 - 90*x5*x6**2,
  1898. 2916*x5**7 - 567*x5**3*x6**2 + 347680512*x5*x6**12 + 196668*x5*x6**6 - 4*x5,
  1899. 14*x1*x6 + 504*x4*x5*x6**2 + 252*x5**3*x6 + 20155392*x5*x6**11 + 8640*x5*x6**5 +
  1900. 7*x6,
  1901. 2548*x4**3 + 19813248*x4*x6**6 - 637*x4 + 39182082048*x6**15 + 30326400*x6**9 +
  1902. 4428*x6**3,
  1903. 1911*x4*x5**2 - 68796*x4*x6**4 - 68796*x5**2*x6**3 - 362797056*x6**13 + 151632*
  1904. x6**7 + 50*x6,
  1905. 1274*x1*x5 + 1651104*x4*x6**5 + 5733*x5**4 + 1238328*x5**2*x6**4 + 637*x5 +
  1906. 6530347008*x6**14 - 1667952*x6**8 + 192*x6**2,
  1907. 1274*x1**2 + 1274*x1 + 1274*x4**2 + 206388*x5**6 - 85995*x5**2*x6**2 -
  1908. 11754624614400*x6**18 + 9498228480*x6**12 + 9295668*x6**6}$
  1909. setring r2$
  1910. m2:=change_termorder1(m,r1);
  1911. m2 := {46656*x4*x5*x6**6 - x4*x5,
  1912. 80621568*x5*x6**13 + 44928*x5*x6**7 - x5*x6,
  1913. 2*x1*x4 + x4 + 1296*x5**3*x6**3 + 3*x5*x6,
  1914. 637*x2 + 1077507256320*x6**17 - 927987840*x6**11 - 806157*x6**5,
  1915. 7*x4**2*x5 + 252*x4*x5*x6**3 - 30233088*x5*x6**12 - 17496*x5*x6**6,
  1916. 58773123072*x6**19 - 47869056*x6**13 - 45657*x6**7 + x6,
  1917. 2548*x4**2*x6 + 91728*x4*x6**4 + 362797056*x6**13 - 33696*x6**7 - 141*x6,
  1918. 17199*x5**4*x6 + 1238328*x5**2*x6**5 + 4353564672*x6**15 - 5003856*x6**9 - 1328*
  1919. x6**3,
  1920. 4245696*x5**2*x6**7 - 91*x5**2*x6 + 8707129344*x6**17 - 12130560*x6**11 + 256*x6
  1921. **5,
  1922. 7*x3 - 567*x5**5 - 204120*x5**3*x6**4 + 524880*x5*x6**8 - 90*x5*x6**2,
  1923. 8491392*x4*x6**7 - 182*x4*x6 + 19591041024*x6**16 + 10917504*x6**10 - 243*x6**4,
  1924. 2916*x5**7 - 567*x5**3*x6**2 + 347680512*x5*x6**12 + 196668*x5*x6**6 - 4*x5,
  1925. 14*x1*x6 + 504*x4*x5*x6**2 + 252*x5**3*x6 + 20155392*x5*x6**11 + 8640*x5*x6**5 +
  1926. 7*x6,
  1927. 1911*x4*x5**2 - 68796*x4*x6**4 - 68796*x5**2*x6**3 - 362797056*x6**13 + 151632*
  1928. x6**7 + 50*x6,
  1929. 2548*x4**3 + 19813248*x4*x6**6 - 637*x4 + 39182082048*x6**15 + 30326400*x6**9 +
  1930. 4428*x6**3,
  1931. 1274*x1*x5 + 1651104*x4*x6**5 + 5733*x5**4 + 1238328*x5**2*x6**4 + 637*x5 +
  1932. 6530347008*x6**14 - 1667952*x6**8 + 192*x6**2,
  1933. 1274*x1**2 + 1274*x1 + 1274*x4**2 + 206388*x5**6 - 85995*x5**2*x6**2 -
  1934. 11754624614400*x6**18 + 9498228480*x6**12 + 9295668*x6**6}$
  1935. setideal(m1,m1)$
  1936. setideal(m2,m2)$
  1937. setgbasis m1$
  1938. setgbasis m2$
  1939. modequalp(m1,m2);
  1940. yes$
  1941. % ==> Different hilbert series driver
  1942. setideal(m,proj_monomial_curve(w1:={0,2,5,9},{w,x,y,z}));
  1943. {x**5 - w**3*y**2,
  1944. w*y**3 - x**3*z,
  1945. y**4 - w*x*z**2,
  1946. x**2*y - w**2*z}$
  1947. weights:={{1,1,1,1},w1};
  1948. weights := {{1,1,1,1},{0,2,5,9}}$
  1949. hftestversion 2;
  1950. hf!=whilb2$
  1951. f1:=weightedhilbertseries(gbasis m,weights);
  1952. f1 := ( - w**5*x**17 + w**4*x**17 - w**4*x**15 + w**4*x**8 + w**3*x**15 + w**3*x
  1953. **12 + w**3*x**6 + w**2*x**10 + w**2*x**7 + w**2*x**4 + w*x**5 + w*x**2 + 1)/(w
  1954. **2*x**9 - w*x**9 - w + 1)$
  1955. sub(x=1,ws);
  1956. ( - w**5 + w**4 + 3*w**3 + 3*w**2 + 2*w + 1)/(w**2 - 2*w + 1)$
  1957. % The ordinary Hilbert series.
  1958. hftestversion 1;
  1959. hf!=whilb1$
  1960. % The default.
  1961. f2:=weightedhilbertseries(gbasis m,weights);
  1962. f2 := ( - w**5*x**17 + w**4*x**17 - w**4*x**15 + w**4*x**8 + w**3*x**15 + w**3*x
  1963. **12 + w**3*x**6 + w**2*x**10 + w**2*x**7 + w**2*x**4 + w*x**5 + w*x**2 + 1)/(w
  1964. **2*x**9 - w*x**9 - w + 1)$
  1965. sub(x=1,ws);
  1966. ( - w**5 + w**4 + 3*w**3 + 3*w**2 + 2*w + 1)/(w**2 - 2*w + 1)$
  1967. f1-f2;
  1968. 0$
  1969. % ==> Different primary decomposition approaches. The example is due
  1970. % to Shimoyama Takeshi. CALI 2.2. produced auxiliary embedded
  1971. % primes on it.
  1972. vars:={dx,dy,x,y};
  1973. vars := {dx,dy,x,y}$
  1974. setring(vars,degreeorder vars,revlex);
  1975. {{dx,dy,x,y},{{1,1,1,1}},revlex,{1,1,1,1}}$
  1976. f3:={DY*( - X*DX + Y**2*DY - Y*DY),DX*(X**2*DX - X*DX - Y*DY)}$
  1977. primarydecomposition f3;
  1978. {{{dx**3,
  1979. dy**3,
  1980. dx**2*dy,
  1981. dx*dy**2,
  1982. dy*( - dx*x + dy*y**2 - dy*y),
  1983. dx*(dx*x**2 - dx*x - dy*y)},
  1984. {dx,dy}},
  1985. {{x*y - x - y,
  1986. dx*x - dx - dy*y + dy,
  1987. - dx + dy*y**2 - 2*dy*y + dy},
  1988. {x*y - x - y,
  1989. dx*x - dx - dy*y + dy,
  1990. - dx + dy*y**2 - 2*dy*y + dy}},
  1991. {{dy,x - 1},{dy,x - 1}},
  1992. {{dy**2,
  1993. dy*x,
  1994. x**2,
  1995. dx*x + dy*y},
  1996. {dy,x}},
  1997. {{dx,y - 1},{dx,y - 1}},
  1998. {{dx**2,
  1999. dx*y,
  2000. y**2,
  2001. dx*x + dy*y},
  2002. {dx,y}},
  2003. {{y**2,
  2004. x**2,
  2005. x*y,
  2006. dx*x + dy*y},
  2007. {y,x}}}$
  2008. showtime;
  2009. Time: 238124 ms plus GC time: 6033 ms
  2010. end;
  2011. 4: 4: 4: 4: 4: 4: 4: 4: 4:
  2012. Time for test: 238140 ms, plus GC time: 6033 ms
  2013. 5: 5: Wed Jan 27 22:52:01 MET 1999