Opened 4 years ago

Last modified 23 months ago

#20390 new defect

AssertionError in real_roots.real_roots()

Reported by: mmezzarobba Owned by:
Priority: major Milestone: sage-7.2
Component: algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

sage: Pol.<n> = QQ[]
sage: pol = (-28524712624242039055315336000413967778733418480863118977869865132075390079059109742198859964232127005/1451626239969468099340993140755597642170368*n^85 + 106129053170798145292157267201895276884016106806128019074207858099654340989739989819086948789647680411711/6532318079862606447034469133400189389766656*n^84 - 48187461003922327740551674859848326512999070262843108330739019140511010180683826810454677328853749567659529/9798477119793909670551703700100284084649984*n^83 + 42762289309042999830570418433539358762819280522472412204583485774468713937906840315002959365007403789113983333/58790862718763458023310222200601704507899904*n^82 - 2618262455746996034793717082427769260012747160045137879009436993298900640475242462655902215693284389473549525853/39193908479175638682206814800401136338599936*n^81 + 21184278324043255960865454202595855100443658574318565625522527050972139625986684343158454636555343817236600979557/4899238559896954835275851850050142042324992*n^80 - 43366900101688156340338924312027109375611629318571702313036703102942950280704023013723734060949072250338097966263/204134939995706451469827160418755918430208*n^79 + 13572135639646239474763103960005344090575994043190066312356381948195830305343420437915768559698229005465629179977771/1633079519965651611758617283350047347441664*n^78 - 2621950604238651742641700807396667564130622602387996727209846221545805994994062896408231034527495711169978850180116385/9798477119793909670551703700100284084649984*n^77 + 213541759148758791831119082131136221510572110310516167585008032697272377714912315344199105604174026356568352724364112571/29395431359381729011655111100300852253949952*n^76 - 51857932671475150757351386835473140539389211185900765104711839807127640289329023366920218966169252835344633871733079851/306202409993559677204740740628133877645312*n^75 + 33702068710711968826608440662977108099998066632506421948624544601354866434420790701794657988262260923208242812844178431373/9798477119793909670551703700100284084649984*n^74 - 1809429934990413763624860745414371427044930547717750702590658010864143409159073381528696539124438620399757738683135469876707/29395431359381729011655111100300852253949952*n^73 + 2400324019270149165515899070382263844082746063647750106754802717767023339894255870442874721441739829329917440319024965982791/2449619279948477417637925925025071021162496*n^72 - 8563390247528340528803408428350155033736370396166974037074003432558960979000532892313091186161660022197220844642101865296931/612404819987119354409481481256267755290624*n^71 + 441074701733100682032818138203764777734702675472074278029850710261302021681370301127998740635090960193435126788416296708873997/2449619279948477417637925925025071021162496*n^70 - 41228517545242808616083101310512767978764159118535358927545416990880852361293634185679618332142179596636676160119205219464875241/19596954239587819341103407400200568169299968*n^69 + 219597858716984702598026480348555525565465597400033851995577594297145515979345111884385202040155124918058177443774789295204315343/9798477119793909670551703700100284084649984*n^68 - 3212472730211623163653269657051594893068965842200301918670128210554692406592337278919297930353479378182025697704072123206071433569/14697715679690864505827555550150426126974976*n^67 + 19190664269507997348121536288459319782965183142745351113470155438684896178634719723368680838643642647036315341062757807537906154017/9798477119793909670551703700100284084649984*n^66 - 316993213555679391726210288889440824656684302928783359105489910754134411008475416023517691831185162336039875428364650552399081287643/19596954239587819341103407400200568169299968*n^65 + 453700925885694764994609854627854639453901855081341311952679430525187241742746023627902014882378414521161140252336619806026588066259/3674428919922716126456888887537606531743744*n^64 - 44565821448374992726481694737317462894037084667361374427083302044226433288822386946993072592760771028569874689570492426160471274853/51033734998926612867456790104688979607552*n^63 + 3511791416828609821132523477752726791348888447614622129379516952226997340972812157324216161592305714494138617534853515688835690265891/612404819987119354409481481256267755290624*n^62 - 343243069912338715119597661756552935584869354986864776842628621594257110669008625530358180165633959774582416557434506894159576800813631/9798477119793909670551703700100284084649984*n^61 + 61058231989649998211427458286138470940800166799620647173200436577482489844896721411902702381559157615799572644306120571256347297715033/306202409993559677204740740628133877645312*n^60 - 2594857585618410103811665572559679461480204576934813372672198100081875578449829536676827679192156087507735621503592686015318319569054463/2449619279948477417637925925025071021162496*n^59 + 38643205696871931088560343392723663793721450517311357581197348085972006850651379397908469890727322014156754805531372384917934258884082233/7348857839845432252913777775075213063487488*n^58 - 26587101559599614179573549328248440296070700391106639612726146191189142418008441481898231843143150160848122488375760942488533270381965789/1088719679977101074505744855566698231627776*n^57 + 260172203220611089845780395010476873024675206853025482743895281428542524137915961075729990235009825605734086355583701542828515755744654977/2449619279948477417637925925025071021162496*n^56 - 795465537263071015534002209903430699836574801760918154756784997483043711478399066381468461072138847229375269678063461818223616667147525357/1837214459961358063228444443768803265871872*n^55 + 4055881045582182715054862248335323340571359119514227264959526835412120843088363219481502169719358570215952452846674295573109383381966568399/2449619279948477417637925925025071021162496*n^54 - 232938877013346540679103993878875270665268548639082935555531923233007720357876752038759810387582440553127791742725418153751269272823934452071/39193908479175638682206814800401136338599936*n^53 + 130881972954338736275105980232446932551270675717252216944343334423633686100353250981832325881704829585502714817879812312170071547665564628535/6532318079862606447034469133400189389766656*n^52 - 207295247430367670137381172254411163734326309667243882423819320158131653043316826143196215768336414753194112028756007010334377063964668452811/3266159039931303223517234566700094694883328*n^51 + 3703293710299778086428298075091197811183582634673428689744302209457330235368908199547161021358591598816601332430134512885389938520810937253071/19596954239587819341103407400200568169299968*n^50 - 62203375686471580123784123343410176154057852085289755393064632850731108640967287392595505024286394080915958966085089070168189979119216390880575/117581725437526916046620444401203409015799808*n^49 + 6823163443776981282501002797761805215178988579986714299579334365231130497515469507434830327694924450864403662544894491405592164260113267066031/4899238559896954835275851850050142042324992*n^48 - 2111701208091545604778113051968487213334613488901973060099644573102137636009663456749637159895668136311584812046403255236901911618844144835701/612404819987119354409481481256267755290624*n^47 + 118016656801039867033437791270830297232471341070477873874305984917489400400671377828386021027222101116836987985477338640752126685723502004381085/14697715679690864505827555550150426126974976*n^46 - 86150610675202429982375394372258682929437537147248110966706766731353988695097803881031062025306332157122668012800535492031845329073886020908841/4899238559896954835275851850050142042324992*n^45 + 354813086964037595886750116765126589484373671214105887912883366693443435758600432415651151159926861481543862242245874345000131098589138093684603/9798477119793909670551703700100284084649984*n^44 - 171722909472605390672928310434419590310342927502145772447297828137268659373758006392455417810005950974519882469235840215205074324446403331952599/2449619279948477417637925925025071021162496*n^43 + 1249740677122157841340510720173938982496818680305902066804258835378301132201858801777222065667985704579900970800395319700749127035347303069599779/9798477119793909670551703700100284084649984*n^42 - 133506603371010833132077589933388900916093368576226847867889485617428438674242642766423717090778912114772694554322256935224588309192071225725789/612404819987119354409481481256267755290624*n^41 + 642816318522377843400706703271031804131615785949614263831252339816454051934802079935946547915154891076175998222986212756569771409923774940691045/1837214459961358063228444443768803265871872*n^40 - 20170491501078288581134446640983080002349678089800195837555131264631574033178569040849437674526748426112354165792856744137636796355979355131683/38275301249194959650592592578516734705664*n^39 + 227923784857334381888441976923957413217948530851541376848317379652083235826411690844774576956250569916054003213483419513131311478796934373199691/306202409993559677204740740628133877645312*n^38 - 7240265005176416379053889690882759632762746706289971842422529713015257851057336027687211334756912305077855278328722677019778552164065532729223357/7348857839845432252913777775075213063487488*n^37 + 996882558724619246002003227904557978410704119122718995495379097845567797133963152619588565361410391334636694693278109825629483337968717512808997/816539759982825805879308641675023673720832*n^36 - 1733004085692285900260265585477331156516157016949479940952683307572277609930404252405999890118847400808302285329191868347409967982896415409799385/1224809639974238708818962962512535510581248*n^35 + 117265588340919225361893400152616559392585635699286767863088277529094611306041370243184355655344655945946210297134862660975180909525232420210427/76550602498389919301185185157033469411328*n^34 - 29611263800068275566230203638186900257373612279283812642972792584103598272398962493951716081283975603231524571102070432046643344132637383684229/19137650624597479825296296289258367352832*n^33 + 6965531536301560074645713272094785795253228012325824333420443411433782816880232631896315019052272449901841991391455796806046125376187806894307/4784412656149369956324074072314591838208*n^32 - 9142970171987438597615997005152146581775186485881951321344462268857027158568665487333696909542767828150272682197911086792122026821513583910947/7176618984224054934486111108471887757312*n^31 + 12893524121483164761537310026969146503292685575182290476950350242914657414391293053309633978507935082501960432131112445708436256817316489239/12459407958722317594593942896652582912*n^30 - 6467354526540620489642420756923455173462978731025907853169965733676787089535857410729802244748839753795163548108696074172235639671537100759/8306271972481545063062628597768388608*n^29 + 2248198215893424811476813300390874102843931372799615421331899101546483463602279740457249425339371795735262078632116839134988360939715223723/4153135986240772531531314298884194304*n^28 - 80020564367455378146684948091148376360562062241125870664822725933825169415158183384353136876972744429856426569768858099840647877705690007/230729777013376251751739683271344128*n^27 + 490585126108898559374431784920654270112603802910220279530374628644096434864728916969337852643644926171227475356337479142258234339070031/2403435177222669289080621700743168*n^26 - 66073504438022085528467639050728145775784269135333710822304366556644940625846993430955633327788851038115280922413767720008185805414403/600858794305667322270155425185792*n^25 + 901348438337341035274724698441799840705173584801487754149095521681387839822659827057552501530610206533328065459726466445471298098837/16690522064046314507504317366272*n^24 - 66929813811935451825454410566167178573240768796194075400923295970402593210981550939143630462172584295448457604630405070600696853719/2781753677341052417917386227712*n^23 + 1681295438300968627769053952625967798309111365872391720500275328597486352140241954859373243298123154434989365676432582334283611893/173859604833815776119836639232*n^22 - 5607051673965509789953274338155832185101485475533415602600000257942892945334509734473787755910703785087486186306170609745870133/1609811155868664593702191104*n^21 + 3590637386720442005402477768988546933545272496775843175260358165964885850288875947727556104978246161793242426123216758011053447/3219622311737329187404382208*n^20 - 506058176618441495038176401204534369182994150081466863944671455666741210467793304506009389747049444131711956835710759233397941/1609811155868664593702191104*n^19 + 861538898207043961047669466632570506687338219508418340094737780497618128612605571852860272753799185426692758249207969703345/11179244137976837456265216*n^18 - 15072584106783073774904665954367274557501302637483181456155309205953606894402191641741301955971958200170822616793794577585/931603678164736454688768*n^17 + 663804358691226265591073685749685611746140406890360067849368534141655460689054294361547637680734933893196467848359580143/232900919541184113672192*n^16 - 5301240044439525252134982074833108095455875778905014197655556283070369216994066731156090716107200104890178264317038977/12938939974510228537344*n^15 + 6220084452552043967635060245197312388501290170430731456055726736507132343414103218664244762853792885616026198198505/134780624734481547264*n^14 - 514810176078266640412018821895444140385603064721798916602413778330571818858202473017015450291035298094664430873725/134780624734481547264*n^13 + 1546468651746133868702294176342894895267439358913165081888164869199810853512873675122324919432312199003142551027/7487812485248974848*n^12 - 758920559048027343748732545186719290162745430942201696641161166096623883661324931066893164360154890187720241/138663194171277312*n^11)
sage: from sage.rings.polynomial.real_roots import real_roots
sage: real_roots(pol, (QQ(0), QQ(827)))
...

AssertionError:

Change History (2)

comment:2 Changed 23 months ago by mmezzarobba

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.real_roots (build/cythonized/sage/rings/polynomial/real_roots.c:47075)()
   4053 
   4054             oc = ocean(ctx, bernstein_polynomial_factory_ratlist(b), linear_map(left, right))
-> 4055             oc.find_roots()
   4056             oceans.append((oc, factor, exp))
   4057 

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.ocean.find_roots (build/cythonized/sage/rings/polynomial/real_roots.c:35103)()
   3069         """
   3070         while not self.all_done():
-> 3071             self.refine_all()
   3072             self.increase_precision()
   3073 

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.ocean.refine_all (build/cythonized/sage/rings/polynomial/real_roots.c:35430)()
   3114         while isle is not self.endpoint:
   3115             if not isle.done(self.ctx):
-> 3116                 isle.refine(self.ctx)
   3117             isle = isle.rgap.risland
   3118 

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine (build/cythonized/sage/rings/polynomial/real_roots.c:37966)()
   3367         self.shrink_bp(ctx)
   3368         try:
-> 3369             self.refine_recurse(ctx, self.bp, self.ancestors, [], True)
   3370         except PrecisionError:
   3371             pass

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine_recurse (build/cythonized/sage/rings/polynomial/real_roots.c:39863)()
   3515                         return
   3516                 else:
-> 3517                     self.refine_recurse(ctx, p1, ancestors, history, False)
   3518                     assert(self.lgap.upper == p2.lower)
   3519                     bp = p2

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine_recurse (build/cythonized/sage/rings/polynomial/real_roots.c:39705)()
   3510                         if not lisland.done(ctx):
   3511                             try:
-> 3512                                 lisland.refine_recurse(ctx, p1, ancestors, history, True)
   3513                             except PrecisionError:
   3514                                 pass

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine_recurse (build/cythonized/sage/rings/polynomial/real_roots.c:39863)()
   3515                         return
   3516                 else:
-> 3517                     self.refine_recurse(ctx, p1, ancestors, history, False)
   3518                     assert(self.lgap.upper == p2.lower)
   3519                     bp = p2

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine_recurse (build/cythonized/sage/rings/polynomial/real_roots.c:39705)()
   3510                         if not lisland.done(ctx):
   3511                             try:
-> 3512                                 lisland.refine_recurse(ctx, p1, ancestors, history, True)
   3513                             except PrecisionError:
   3514                                 pass

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine_recurse (build/cythonized/sage/rings/polynomial/real_roots.c:38939)()
   3471                     rv = bp.try_rand_split(ctx, [])
   3472                 if rv is None:
-> 3473                     (ancestors, bp) = self.more_bits(ctx, ancestors, bp, rightmost)
   3474                     if rv is None:
   3475                         rv = bp.try_split(ctx, [])

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.more_bits (build/cythonized/sage/rings/polynomial/real_roots.c:41622)()
   3617                     assert(rel_bounds[1] == 1)
   3618 
-> 3619                 ancestor_val = split_for_targets(ctx, ancestor_val, [(self.lgap, maybe_rgap, target_lsb_h)])[0]
   3620 #                 if rel_lbounds[1] > 0:
   3621 #                     left_split = -exact_rational(simple_wordsize_float(-rel_lbounds[1], -rel_lbounds[0]))

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.split_for_targets (build/cythonized/sage/rings/polynomial/real_roots.c:32908)()
   2880     split = wordsize_rational(split_targets[best_index][0], split_targets[best_index][1], ctx.wordsize)
   2881 
-> 2882     (p1_, p2_, ok) = bp.de_casteljau(ctx, split, msign=split_targets[best_index][2])
   2883     assert(ok)
   2884 

/home/marc/co/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.interval_bernstein_polynomial_integer.de_casteljau (build/cythonized/sage/rings/polynomial/real_roots.c:9092)()
    728             msign = sign
    729         elif sign != 0:
--> 730             assert(msign == sign)
    731 
    732         cdef Rational absolute_mid = self.lower + mid * (self.upper - self.lower
Note: See TracTickets for help on using tickets.