// LIB "tst.lib"; LIB "ffmodstd.lib"; tst_init(); proc tst_test_ffmodstd(ideal I) { ideal Jtst = ffmodStd(I); Jtst; } ring R = (0,t(1..4)),(x(1..6)),dp; poly f1 = (96*t(1)+59)/(13*t(1)^2)*x(3)*x(4)^2*x(6) +10/(23*t(1)^3+4*t(1))*x(3)*x(5)^2*x(6); poly f2 = (1165*t(1)^2)/(252*t(2)^2)*x(1)*x(2)^3 +(89*t(2)^2)/(82*t(1)^3)*x(1)*x(2); poly f3 = (10*t(2)^3)/(33*t(1)^3)*x(1)^3 +(5*t(2))/(41*t(3))*x(1); poly f4 = (3977*t(1)^3+533*t(1)^2*t(2)+2173*t(1)*t(2)^2 +806*t(1)*t(2)+3286*t(2)^2)/(3977*t(1)^2 +6014*t(1))*x(1)^3+(22*t(1)*t(2)^2)/(5*t(1)^2+ 61*t(2)^2)*x(2)^3+(42*t(1)^3 +65*t(2)^3)/(65*t(1)^2*t(2)+47*t(1))*x(1)^2; poly f5 = (3741*t(1)^4+94)/43*x(2)*x(3)^2 +(8*t(1)^2)/21*x(3)*x(6)^2+(54*t(1)^2)*x(3)^2; poly f6 = (96*t(1)^2*t(2)^2+41*t(1)*t(2)^2*t(4))/(95*t(1)^2*t(3)^2 +32*t(2)^3*t(4))*x(1)*x(2)*x(3)*x(5) +(31*t(1)*t(2)*t(3)^2+11*t(2)^2*t(3)*t(4))/(39*t(1)^4+ 51*t(1)^3*t(2))*x(3)^3*x(5)+(21*t(1)*t(4) +90*t(3)^2)/(37*t(1)*t(3)+62*t(2)^2)*x(3)*x(4)*x(5)^2 +(63*t(1)^2*t(2)*t(3)+27*t(2)^4)/(16*t(1)^3*t(3) +67*t(2)^4)*x(2)*x(3)^2; poly f7 = (726*t(1)^4+205*t(1)*t(2)^4)/(110*t(2)^3)*x(1)^2 +(61*t(2)^2)/(36*t(1)^2)*x(1)*x(3); ideal I = f1,f2,f3,f4,f5,f6,f7; tst_test_ffmodstd(I); kill R; ring R=(0,a,b),(x,y,z),dp; ideal I = x^2*y^3*z+2*a*x*y*z^2+7*y^3, x^2*y^4*z+(a-7b)*x^2*y*z^2- x*y^2*z^2+2*x^2*y*z-12*x+by, (a2+b-2)*y^5*z+(a+5b)*x^2*y^2*z- b*x*y^3*z-x*y^3+y^4+2*a2*y^2*z, a*x^2*y^2*z-x*y^3*z+3a*x*y*z^3+ (-a+4)*y^3*z^2+4*z^2-bx; tst_test_ffmodstd(I); kill R; ring R = (0,a), (v,w,x,y,z), dp; poly f1 = (a+1)*xz + (a+3)*v2; poly f2 = w3-az3; poly f3 = av3-x3+xyz; poly f4 = (a2+a)*wz +xy; poly f5 = y3-ax2; poly f6 = vz+awx+vy; poly f7 = (a)*xz+(a-2)*y2 +v2+(a+7)*z+(a-5)*w-7v+wy +(a+1)*xz+(a+3)*v2; poly f8 = ((a2-2a)*x2+v2)*(ay2+(a2+a)*wz+xy); ideal I = f1,f2,f3,f4,f5,f6,f7,f8; I = subst(I, v, (2a+3)*v, w, aw-6, x,(a+1)*x+5,y,(a+7)*y, z,(a2+2)*z-1); tst_test_ffmodstd(I); kill R; proc tst_test_polyInterpolation(list l, list m, list #) { def F = polyInterpolation(l,m,#); F; } ring R = 0,x,dp; list l, m; int i,j; j=5; poly g = x12+6x10+15x8+21x6+20x4+18x2+9; g = g**3 + g**2; g = g**3 + g**2; g = g**3 + g**2; g = g**3 + g**2; g = (x20+1)*g; for(i=1;i<=deg(g)+1;i++) { l[i] = number(subst(g, var(1), j)); m[i] = j; j = j+2; } list G = m,l; tst_test_polyInterpolation(G[1],G[2]); kill R; proc tst_test_fareypoly(poly g, poly f) { def F = fareypoly(g,f); F; } ring R = 0,x,dp; poly g = x+2; poly f = x+5; poly f1 = g**2*(2*g+1); poly f2 = f**3*(5*f+3); poly g1 = f1**2*(2*f1+1); poly g2 = f2**3*(5*f2+3); g1 = g1**2*(2*g1+1); g2 = g2**3*(5*g2+3); poly V = (x+1)**120; poly B = extgcd(g2,V)[2]; poly D = B*g1; D = reduce(D, std(V)); tst_test_fareypoly(D, V); kill R; proc tst_test_BerlekampMassey(list L, int i, list #) { def F = BerlekampMassey(L,i, #); F; } proc tst_test_sparseInterpolation(poly Br, list La, list lpr, int n, list #) { def F = sparseInterpolation(Br, La, lpr, n, #); F; } ring R = 0, (x,y,z), dp; poly f = xy + yz + x3 + xz + y2 + z2 + x2y + y2z + z3 + y3xz + x2yz + xyz3; f = f*(5*f+3); list lpr = 3,5,7; list La; int i; int sz = size(f); for(i=0;i<=2*sz;i++) { La[i+1] = number(subst(f,x,bigint(lpr[1])^i,y,bigint(lpr[2])^i, z, bigint(lpr[3])^i)); } tst_test_BerlekampMassey(La,1); poly Br = x74-54472460x73+1014467839629059x72-8499597866245997251000x71 +36893332331731074482086713282x70-94759542229929161636688587661062160x69 +157425425590067265660664379790220549018238x68 -179868323233948804218947117384212045127712282760x67 +147881860653284334337732173452372245172393903788522933x66 -90621244107370390615019157488255096205372733720543057373700x65 +42567069550627706125441015789765036698673321537921465915326727847x64 -15675814819213526695338129257985210064298417656503832613916904263942080x63 +4608724339341574308156997521660533868576671156256471517956791996108292444784x62 -1097689519090498770143052938200167209461376346560869869554877816918722258858023680x61 +214314076010177334411487995643939125339518665992133893201650684143031133479180507459856x60 -34627956216291187649499144604874486233157732963842780992413343149156684084496268178081764160x59 +4665948554772215729725596402217867175460234028650425333364957332982148826644010708280887910236500x58 -527564971703446319404309762754952391927160392023202193543054330190259943765183801540475782463667678000x57 +50303995712348074539860499723507590147040682491902038288121143859622453061314072261818139465571874584797500x56-4061405540260208128172019046034497232301764908317931135682879224612397318817936159713172691412178054716552100000x55+278571453535764560269056459688944465990579098700058937700344751665541739204566777093833247480757600109902607146875000x54-16277449898938513777165776839330813781343977391489107144565634893991729369955669948366411142959022794422443953523005000000x53+812204167592690893922703823737026812810095155544739416237060244976875949165881965709988428146745759516558515658418968303125000x52-34682628210226198504907985488821392993315102571095383483593887001514772772624201448886732905302231263460217727413661471201937500000x51+1270037894024447102632972046609200140186933620941392037736723334010432067886134923719680713189101452578179155129389016168093917382812500x50-39963102348764331219181505045702337054199817357295091197078527765301424942729804320785362366581037025525048391747255793580941228694531250000x49+1082764379210102893927030028391280179161337333949726751702371301804971251937588935621746903183820791023237056352308855430589029742075663085937500x48-25313950561366205591530105837942862588272331357019526791242665956615567475884974508246730096131063469136150320678107731866610011967622865078125000000x47+511774048772508199269154871022114188952939946108026935525218751401557726817385651432518844634447170885075842409296057299736547390232484288779785156250000x46-8966874835924414908134219585411196255383658494732464342029752829181208856189888101281365243961482901048254024471455960204522793325482632152800890625000000000x45+136456936267927824727029039411939824011435314057649208694882241948601968472547393251140337030653393254271383412940842498147406953291646670762093487185058593750000x44-1807452214796623660545820643749755452342895329401096473055750844288281079724858455655270566138587540914209426586057186480658967234026374819636090307752099609375000000x43+20880559160411211659949717262913509464136953867655730291541791195303326398550032530488506926176087733507771300648370825910845174769707664886067765522261846427917480468750x42-210794271433602374543268308968502486561860551318423553180129968235571896336325849450903081329134331729420871801099768297289571335511432836352189016733367484807281494140625000x41+1862924374537600554712070456730223104217693444010227920644627850419828837153397014495940051643928775653477500818009765855154927104656686593125996606255574197280152320861816406250x40-14436619754122496052521695752940783789878754362858202808029885333150644406178169605097949186155355646978437048779419877627148344217057656092146323328048181629070623970031738281250000x39+98246541145712421709210086367433495693218869170435280266693615988566412413273543602061685165820307685971224946080626457035071648946857577767756717375237965462520348500013351440429687500x38-587937929815002716147374414039521455001360110355877278721981523250038582018125119960249913638500727704155856451964651563149839779521720534152072908585280862095017662962675094604492187500000x37+3097590436250474554483603319937621769743159489487689351644651269911907868802941562951362909859197236748439122176459195763660895987908155873747729114527909373632853080087632685899734497070312500x36-14382940522159199910498852042931523458369129234941932859648594216609972283722535369542846519364142782603805477598727382001022433158558027522708507951917020137500448290800252482295036315917968750000x35+58910762299439741177873092208823398315124986642178825486155029892164723821356995833660531093779360706018322044214087684120985181251444920507703511092239384789763903627031061406945809721946716308593750x34-213008953697287801634198760728504348435941231740763760629565494495231158638208890479138968736565034323419039721265782129350545963108589160123721225068435585205101690852854226902197115123271942138671875000x33+680349212936485563757424457170778614957110424918552555717434474599214043722093452422609142178512273148453659556563672581194573087032954640745563130765484826598892375840842699959039018722251057624816894531250x32-1920490508252733703797134309692306233834387928490776376816095481021857982601401811315659503504151938658239786925010193242540564298056892649359746703730943056587839701373411694335705251432955265045166015625000000x31+4792838442306247971036802087817208856741768288694791613526982482745006963236010174640704869892838982036855856877498570775680988527753341475412434210991507940424472923346448258387939105887198820710182189941406250000x30-10577002608192819960870560152623956474737533796310182619791483663640094967174380425793001070956164343427912520089148871776527856074628230136289037342208139093533350821569194460370910308265592902898788452148437500000000x29+20641422505939223497784554469435266797633005066747708276868192807800568460281966923384353866302624915610420963781727302212259813678751165404890336864083992417795469995860166275019069177685651084175333380699157714843750000x28-35617517469099166122633224395035536318326550728537291048289358805563985597850584777656544514876525800676969897268329397126681494270011175657011883248505706028148682943655810781591330037947000164422206580638885498046875000000x27+54323444670673496845852190297410109426948003665271181829948260475891403709786800732739727271736471978499767665912252970821561478134880133262727568568357334073966811568437765380391820402536044767316525394562631845474243164062500x26-73192274878976960431202570671195130314662337813582669247382361626929003766746484666043182396939030509714268039733131613825256668616724751196403050518258182909446362391184985217625758441057157504872066056123003363609313964843750000x25+87044544683267767126827331475712889012710622515421661997066831205859255663018636471043181560239727261941849179984879069081183314540864577918900556162679677719458697456257928006833849163167889463421644791196740698069334030151367187500x24-91271474405496668546356279819516229868029492585859748007456389992680579314124443640844405658709511311459809668765640014416220378512297016574622885540345554821479954443135243422744656315034916812587439949311374220997095108032226562500000x23+84260162371493314087210370529279006843638188061645895390272340394642908804223340220783363010176459753225209053443048996091709925451139645103671984534080996653351830723728415995732029758455330157329743467897742448258213698863983154296875000x22-68362433904486197723468436287634542822009525271958779234806318016771972826733481841180809952306739764794132396118745625987047322938498293162252440225711053380417143106182575748111708405714782547648289412478561644093133509159088134765625000000x21+48635043642006464777607355452170616129489565818833058265693678616784696160624356895344768270148967025570990843331367577604000939659780732420051854523272600585467190395560608433538155861462202428692104712315558145974137005396187305450439453125000x20-30257471051717183612098157490118066312475950099157731470395160228394678099004750789898292310984670773188334168694795392145764737627552480775633088202529765572245197745120447448942880850412073586452627645820845359025952348019927740097045898437500000x19+16407232404266136775504365651380658155383607687328157913023722857567973127014099617912579203380576797472564954849672365691957001760295129161359218027826461578861812284245948330046253155430125520750635769210660358519149326639308128505945205688476562500x18-7723918630678989151433333342757006901256916059019482731768521934726446157527026933519727875237082273580263831986148034822735850615062745733388505999860941022925051738937483736956741655005665125106365570588568339460699974097224185243248939514160156250000x17+3141832660725932056438142554051784042382127945257348350706539777451359181267038766940934108830579261315984951951058593876986701234173823633874652695156102490072643398581139042900279891441313984281377295061994821528256194298478476412128657102584838867187500x16-1098038321793979701240355375899271372394079744401764111611923038041175381964623538271288822807309626488743480587165444601972469292700802809300331045809286026984434457133754549386857254583275915547135994939132483221022607011718719149939715862274169921875000000x15+327503607700207283996109249969474976048405033643579801515243046124326086511397476916914255796503554851973350772040330852726591593500525826968555502092553605910185947058369023018075453095551918546007334672325134004985600078008189939282601699233055114746093750000x14-82697656148272281945402030160161115383947821754039729042837351068727736046864582758471305622031635373909692175837575831151164510377891053791060781407924268651786099533094313807139150884723948016888496311939605242988249322877436497947201132774353027343750000000000x13+17510373798619115396920223920810804927936524930050219218362670713100570584177810700155434291201241133149899225025169877494771307020441283121287792014958675821031503256947170545731323215659238419256811044240541763172700146303228940780627453932538628578186035156250000x12-3073817364464093129922654798374135198906976859277562561853528156239015288340363300557419909895012860935669124648141779082054836882949322389699223463500231863615665327296116801452475908628261880772578762482441423851349028041612942985238987603224813938140869140625000000x11+441339784116397701086241669608543113679383771368398878071333880352467717441590141470630670084126759945279495107335767179302966162545757635737219710078694664455585373005032702585349691779715788944669835816977573127507414972519141950491050607752185896970331668853759765625x10-51011671859277324606184889271767690882659081336603157108542865060080139860389630729340181536916215070228743186257035738203770976826209807532011919997127036369105692992726809172502103911837089775881281030272915883086743143975244890037101797020113735925406217575073242187500x9+4659621060334034041002290553321690787931074377376674864229187158310029009415729236960803894380172821953748527896491120805135600132838523519394628530760112627280750302107179130936574781616528628846805318993802655457388713286676027998216287340227381719159893691539764404296875x8-329420427309291457881798140055731994924173001860072389256261768215488647590609546657513777092594389704362152338814249929912700962656368434083653213407615299992666860167238921360132576517337590638018117856310523599410055942637742701188663385636345992679707705974578857421875000x7+17617758783285739401761233922973208681078621460065860798070131107316646310420264336445258799926415447815815924380713022013106899334936353258863293837819656090121935375485443657128453104524787859510932343024400619014832995656473253466263798050484012946981238201260566711425781250x6-695428643430847303313038803963861090728961864848803748457990913254187893180451133058087139460443813015650629461420870111335053385194129746808976223107352755393335449149441460610747636894604982843140734769681061552202420434873990498026233297856890658295014873147010803222656250000x5+19692842429991361356273156539453377278727431170003450939118178315286533954648844206585529586753182472383975220647858730149989693250941633929334910199947453540863993291061466673740720579743139995177953200285783560817742721054250670255461900734483826624909852398559451103210449218750x4-385176402393896224602130577489074446111719025264410759956955530750486165164283399567555697292015327715718678831764377511763192958272800165198593334054508869250303564070148992951075121532772396765892140646342566164686705592302892299389209702920044975371638429351150989532470703125000x3+4902762190695121018552265686425009394811063842450216382721466968442428014442959128872670995640216726217641942007692639101366352728948285708167317926081090464918188525333750983104528637149426268528479275718542590248742526562409280588602700679153045815183986633201129734516143798828125x2-36314055373315602379028992534740063841811978003043744273283346181897815315273908781502881229874095870716457840528268826656389673733585260978376387947964285938948326064181879412646498648015066167348933045109112978657285287823330165509937898869058381379204547556582838296890258789062500x+118096888393057225480151466174918340008615940363722566459862338082382614244427772302846539579644782144634151697525173634475464659886822935726278645541030399476125390487807064157659444104199295878749726893474447604916938486875305743927698376590472439939816240439540706574916839599609375; tst_test_sparseInterpolation(Br, La, lpr, 0, 0); tst_status(1);$