# How to make GroebnerBasis Work or to speed NSolve up [closed]

I consider a set of three polynomials of two variables

Polyn={(0.004671149610381033724043189200478113888440102-0.325925808646329055667007855734330071329635212 I)+(0.68728976813168552981398417782014296877111780+1.67616729895363283723691400292975710594446107 I) x-(0.63829617152874386839608050490026526983150810+2.00266216305072924314325574583007067338005493 I) x^2+(1.53981001328539066542905621757610489024601619+1.67920556644760411731730020098242711096029663 I) x^3-(1.47828530500684345606280815454015431646223515-0.31566885603061204483517280735882204548230016 I) x^4+(0.26049469352739853518524342541349672028171578-1.28566865148143962811213788311832016737932204 I) x^5+(0.33493050594349093459297984056944222518488976-1.72988459093211386356860666462933068142319525 I) x^6+(1.31239305275882125546960006602735342512090039+0.31789326055026133317663000065464245271119427 I) x^7-(0.426679547648076331034658013614794258369373339+0.881556757690959640993014263859169391012861294 I) y-(0.571554993146895253755829124998212585660214703-0.020335088949544796962042219312520352996936852 I) x y-(1.11406041265012853711935333747991649005186542-1.20678953802393292304374353226949346413978893 I) x^2 y+(0.69770907066235643310158547301192696658228878-3.22855489950470904546116606171672379584588020 I) x^3 y+(1.29830268044326668173665221518494713991561652+0.23091273889590570882442404782511131451719457 I) x^4 y+(0.80397098573594239616428286139442716327745486+1.39988240453352312622064517466230818829092399 I) x^5 y-(1.53198597179298992746745871237194334636205340-0.60413892436626182263552677760324985215689543 I) x^6 y-(0.005681272303542629320287533588639452912121278-1.092357705471474502624628314067150534267269274 I) y^2+(1.12773122181646884174216193504662212088623637-0.86432568911174109393625070601702945530698096 I) x y^2-(0.137681170706644960347336850577917789011775779-0.350900708485547228446227785925989412217465418 I) x^2 y^2-(1.42214381892350918491569495378178403643467527-2.46021472898077335629899640572306345221529662 I) x^3 y^2-(1.49600108904867185418310834682345445593153823-0.50572009895526818644829857421607197927334118 I) x^4 y^2+x^5 y^2+(0.39815635125971134274942954650489471350275828-1.49804430931345695517238688070839480122278526 I) y^3-(0.683195313123056481775752128835944081326672777+0.118385215014970081569440034844688266744237834 I) x y^3-(0.842596676804253242987712782903504844534524652-0.205796782651399242268470077825322001390874321 I) x^2 y^3+(1.64539444038525270916410148549608995285014629-2.14098370674405354986303554524464465804121428 I) x^3 y^3-(1.37792072412113065938852793774883380172983548-1.62681658140698411725780379219510331682249349 I) y^4+(1.26529644044044078228622045276013384729576701-0.26854574243827645690824175126604875174653333 I) x y^4-(0.737885094704482188120782388300269503450404940-0.030333113084823398322498460634229641924743039 I) x^2 y^4+(2.54023973379056466716296536804752400375539849-2.40863822177730459640019782854712089035807763 I) y^5+(1.67743556448681494106054108902829753165876166-0.02934086410378793961668411434517909886469976 I) x y^5-(2.33107626179897231488543458198224780575068517-2.02345203069495448133007342276432729336675753 I) y^6,

(0.222664801486997648466204567151476448330769285-0.529810628084535667107138230633189236183827821 I)+(0.82361281348318643012195462689948709791743811+3.09343553267916749929266837223957189037664920 I) x-(0.87779214988742598028708716353233455529690656+3.13349013157695735594142753300356473518281441 I) x^2+(1.72925918033433334740066987949936309572606008+3.16198466584610497781631406523911296884869131 I) x^3-(2.51703234984659041071220303372302556784293827+0.86862337199133584766653081835354272227047761 I) x^4+(1.12729116509844575768251979845559881178906280-0.76928923033004102870095392393179455539054815 I) x^5-(0.06285574427808848070738889196122669646458611+2.47600115760280800204597188337157660791873248 I) x^6+(2.12329194799812184178056538025546991557227056+0.62920495981403709600673649986046918626434508 I) x^7-(0.79732724474569543853579762992589825570691179+1.51226976544789669085633019748740465042920931 I) y-(0.894248101899423699421832346992865208753294520+0.676074442757675710465867759375457793960723550 I) x y-(1.20087123786417854934975386384221409819289754-0.59082026399611801958193161174188106098010707 I) x^2 y+(3.28350438936976611604755068473730610973240218-3.06507373173016866456552844645519634045297763 I) x^3 y-(0.045011927413381919865889003548317105024905692-0.500909784236183391362339355174742892392568650 I) x^4 y+(2.56709937961339840601258561482137484091205147+0.37737020386921532034343989652886771221937040 I) x^5 y-(1.93301842125408955374436991515931984107903677-1.22555239541122150213343729668930081182733376 I) x^6 y+(0.01609716971972433216347880034134050599671301+1.95499238291235450826389287958208935677352914 I) y^2+(1.69780205816664491132254633072575451077852118+0.18355142010107168721978414755633418622961998 I) x y^2-(2.99450057896685509335497188156669522513892870-0.21353340746362070697665325510117478095975213 I) x^2 y^2-(1.30263788928645075282860875579843644467731118-1.26009466200803084119072865959780838476873873 I) x^3 y^2-(2.20691881437700548275346776012330856724963446-2.46654482718781116738555648497653300258319383 I) x^4 y^2+(0.85792328124637676846041624679873632144309215-2.56368610547306830953541537366061115980580105 I) y^3+(0.81785912819299331297975734736064770411223016-1.34525013046084092971943392587634042590283305 I) x y^3-(0.41933060775357231228212849156130251827365239-1.97200800116866865327257399110776483464375685 I) x^2 y^3+(1.79892244730664109634823239036356108820913473-3.20006317739131778342293120436681394570401502 I) x^3 y^3+x^4 y^3-(3.20604658959312515495866062928042501316913390-2.79120289368834958295106576869936423588727580 I) y^4+(0.530109229347285870448534936674650940866054247-0.526463275084290518221732085012559587605062487 I) x y^4-(1.28874239312342415558626151171691737806640753+0.73526012497920674784311138427488201161259752 I) x^2 y^4+(5.06117299470308058873646245325284119435508956-3.30204160575589943697511003332193863546073877 I) y^5+(3.34109249457709365055969939589874944258752799+0.81341090265199504925794581388831701350309680 I) x y^5-(4.33242207397378594244644090286827321609276889-2.34948427289098023256069507484268880363001610 I) y^6,

(0.408015021851838550894763858236510147595455429-0.720738605793315800504971864301419511809265156 I)+(0.62479971786367700885966553069890547384677832+4.16115790718498873236805475101653483497466308 I) x-(1.62953920638648007266065295137551709195743800+4.85058400503331689438253590306880068722421093 I) x^2+(3.24039728182860671305011123167838345727411655+3.92204277498151780462453876481237532152697660 I) x^3-(2.75992057736140893108824642507922825001007986+1.40641637793165905799774422838724009741470392 I) x^4+(1.37634321749361456436222696807034294721055131-0.94243952484311284539454542999910107633488297 I) x^5+(0.63186646248981976623048544564051247607317050-3.74888580183936485983361584092902834271465250 I) x^6+(3.18437773753860267849206490255795501644510991+1.18309281377829007962605763288365351537259048 I) x^7-(0.98081101173972721115675087140332448523933052+2.40429928194422132978543926152962269172919230 I) y+(0.20263321862237791576922364570280006463306048-1.25199292876573008800017671554523064193248256 I) x y-(1.48184927245143804303485293770751245726337652-2.41386931950858281200097054928941001449769057 I) x^2 y+(3.01511948913078118455014229176451416392514635-4.11377576321461467414833550269411331696066816 I) x^3 y+(0.18728522318354275759678638099351035417255610+1.17597279813456359639583062469212840556088480 I) x^4 y+(3.35549916844527740602712870385241499133937909+1.57499795162466849067262068483248780711490019 I) x^5 y-(3.08680671420671932685782164143548127805101485-2.06213504176589892487622285826746792518547300 I) x^6 y+(0.07489727616786745497750552197107958851923251+3.24121571854043143288356049163462446638933178 I) y^2+(1.42899775420424719629451418136225288589451661-1.28373425370560674570510077734772538227715991 I) x y^2-(2.29701175853970490666920554256422565147402636-0.01457604557454253820258049926187563010816749 I) x^2 y^2-(2.23054055092755962358068814196922686502769297-1.90519697867832570307478622903932194398724944 I) x^3 y^2-(1.90011239720192685663836591039117408070093667-2.02041720630242492978562512898534312651420371 I) x^4 y^2+(1.42973509204714432130003494006156891300558839-2.71888897641641198223154371671391894389618485 I) y^3-(0.096104069525743217434142856157145261994963672+0.524405080737081013156837403635952792211815556 I) x y^3-(0.14913634753975341218214031681332487061764594-1.67069772298447586895847552649258752596424941 I) x^2 y^3+(1.74097288787744637998314856206888665860402882-2.60695310402294810112233917706501627101690305 I) x^3 y^3-(3.69745350463130000045103753165594585010267986-2.68498638985744111463412617322869372753425951 I) y^4+(1.84204349014007609888379483625984870482168443-0.68983561975507420768556024707731708584426002 I) x y^4-(1.97962799580712697681822524998217372100020086+1.78476116861050982989186764047830594377208884 I) x^2 y^4+x^3 y^4+(6.46545749498845182176782074191976312010838769-3.65470238509105723952270094524850642425438899 I) y^5+(3.62543235618928848748623514860992887656457838+2.05685647754343298093424383668114143143325318 I) x y^5-(5.21066469498910601617209190336418287377007107-2.48370452751282532534565952230628193591862970 I) y^6}


To find common zeros of the polynomials I used the following:

Ze1 = Module[{P1 = Polyn[[1]], P2 = Polyn[[2]]}, NSolve[P1 == 0 && P2 == 0, {x, y}, 50]];

Ze2 = Module[{P2 = Polyn[[2]], P3 = Polyn[[3]]}, NSolve[P2 == 0 && P3 == 0, {x, y}, 50]];

Ze = Intersection[Ze1, Ze2, SameTest -> (N[#1, 1] == N[#2, 1] &)];


It gives the exact result, however NSolve takes a lot of time.

To speed up the solution process I tried to use GroebnerBasis:

Pp = Polyn;
GB = GroebnerBasis[Pp, {y, x}, Sort -> True];
NSolve[GB[[1]] == 0 && GB[[2]] == 0, {x, y}, 50] // TableForm


Unfortunately, GroebnerBasis fails in this case and shows the message:

GroebnerBasis: Excessive loss of precision during computation.


How to make the GroebnerBasis in this case work? Or, maybe, there are some ways to speed up NSolve.

Thank you very much in advance!

## closed as unclear what you're asking by MarcoB, m_goldberg, Alex Trounev, José Antonio Díaz Navas, bbgodfreyMar 28 at 22:33

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Why not just do NSolve[Polyn, {y, x}]? – Daniel Lichtblau Mar 11 at 19:01
• @DanielLichtblau Yes, of course, this is better in general. The code I have mentioned in the question is a part of some biggest algorithm. Therefore it is written in such way. – Anna Veselovska Mar 11 at 19:22
• (1) It is difficult to give a good answer when the question does not reflect the actual situation. From what has been written, I have no idea what are the salient features of the actual case(s) of interest. (2) It is unlikely that a GroebnerBasis computation will improve matters over NSolve. – Daniel Lichtblau Mar 12 at 14:19
• What I meant is that the example does not show whatever aspects cause direct use of NSolve not to be useful (see your remark in response to my NSolve suggestion). As for using NSolve vs preprocessing with GroebnerBasis, timing differences might be specific to version and Method setting. The example in the post seems to behave fine at least in version 11.3. – Daniel Lichtblau Mar 12 at 17:07
• You are trying to do something that is numerically fraught (which is why the lex GB fails, while a graded lex basis as used in NSolve does not). I do not know what else to suggest. – Daniel Lichtblau Mar 12 at 23:43