cali.rlg 70 KB

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