#4632: [with patch, needs review] .roots(ring=QQbar) fails for polynomials with
enormous (rational) coefficients
-----------------------+----------------------------------------------------
Reporter: cwitty | Owner: cwitty
Type: defect | Status: new
Priority: major | Milestone: sage-3.2.1
Component: numerical | Resolution:
Keywords: |
-----------------------+----------------------------------------------------
Comment (by ncalexan):
Still trouble:
{{{
sage: i1 = QQ['x'].0
sage:
64142895751684972523861209285243282417707075329583674916117055188381394775628232666253440274186493488594874737405053591961632429138669138467297304724926962706230467037061800892052686428670590014901138630952149649710687408091127872467041015625
+ \
20518713450315039322056250166088677399879179929554356597510415893439402054648039918099259058046422019712028170247806685000018681797593217868525785092085046308791139713218965061698940798604284522971262298949676588165941352844238281250000000*i1
+ \
12100960474360844852430089655545281513402833676859514717108294878572637167944626649959989923111097779896784230770808939216097183999909581480028275696898705356370334583174123713781608169021012180602575703926423575264648437500000000000000*i1^2
+ \
2605913589677160923631578932221252754861605246045698298923254729863286128917018068286069560387433296812804379214195609656093433213817341016672860153066568159542474331872213113284682303721328193165639027164489675000000000000000000000*i1^3
+ \
658259041485800976464302816116165215588236679873688147456723398511014527766003546546189637018719993970656294140752674263260405589667084004039725718906236759602716546087855161325790058548613293536926140838400000000000000000000000*i1^4
+ \
83854577222399022729090550461001938963657799535621113098887788754207755899629343668467056325038418901089451913134625030675149852634509566282127491809380290734179465166656517242795764550986198273186971648000000000000000000000*i1^5
+ \
11077342604533532525164090252320941615267509311333261074688160935771204008824783486355668815946618659325391586459706407800613824973226349002621729497752971963360336219028604043138670634200427191599104000000000000000000000*i1^6
+ \
881054522285626541517785542148420250688543924427857527709534753295899811009105208652356737247996544458276153340176562728483906684871855873552445635627957227774649742144091721258895691523604820787200000000000000000000*i1^7
+ \
75164979846414113543014721937221377774789918745150707905320399106583691885453904110964557260667320981478056027569246959425808622997355463290946341656722085188899310506124978198222746057718104064000000000000000000*i1^8
+ \
3913181683651999237383556151030509326567625094606369073062492876717959656737362991811448719761936127356389404590392279701275686688334547586721653925980556331947809647149866809107334022823936000000000000000000*i1^9
+ \
207945309923197227675066394920813581825473908934247588739515618804343576736081709076056978177837018217092693772146505845724503343162348632248309255642711748310752466973323126449861233213440000000000000000*i1^10
+ \
6716701065601380210100545970025344666144718133850671325025891235052150864344047553683076758757863399269458671558758355855458326738998435933269138482472116546974274283086234590921097216000000000000000*i1^11
+ \
190893821910195783437104046267707195948674755680199148146705868373592804991712403182669273886408506303303003423730737922041242308788908870982844997014855211593187677984862800707584000000000000000*i1^12
+ \
5867629873133525139602740661293389148687535809186142469423758963783693568989291159182499553241195137899010397662697136940761634420038956221772211285150148829586825005530328596480000000000000*i1^13
+ \
174128066474636339040468251199022844413910131388235902802651357105670999550310866544561172725633537026660188116703713702197111741946500688037944384258694561126973588763574272000000000000*i1^14
+ \
-743655179717315648408847727273753467171201293115039408736167509269910571278730908313802613474563508710939311612895559452283318993584503538008388945032561920510367734169600000000000*i1^15
+ \
2704263466440724763673019600029775165623071386021141657434785834092033407599191379221798097482965813066619946664401950353695134689638751295739555518753625253284413440000000000*i1^16
+ \
-7920657661346328516849663729933551966940189067473758528128786228728342737909655399359152717186692163201977219768061088078556576244522397147089917747732336869376000000000*i1^17
+ \
10815601288653108660863718803498725333145395957746798702542184994173534597009611774372771721245769184996754028158132835031332463558108904175895492173181747200000000*i1^18
+ \
-7025259394914985023537560410179506117495296226061783298311047304126733767683332500692411463584846958339961977350118838859647625974149724354297819299840000000*i1^19
+ \
2049712876434257587528902530951534114406510123534770838199001591149040200985153955268389232240212499713962733296299202327806997075399876196433920000000*i1^20
+ \
-331371072860421205834083116262837202692691752472035902490617155218675792149554941144036688544674077637642745080147334984795364631694750515200000*i1^21
+ \
19924407448746883912216721073318980086041378210199004111080024717375745417807953798733991147988720143895388439350128718933594147389440000*i1^22
+ \
-644111856861065070866706525087980962518494168795535882970210317418977507771523793330182258788377809193026575862244588937805824000*i1^23
+ \
501494943106368931064497262537231425688088044453073779786147096541643930385166983233976016203651376921809329220852121600*i1^24
+ \
410433527627442134308118298393342564356899007258029841287882737255835853884049174995159057694102920573747200*i1^25
+ \
1012629378133008045570223396268111873016080522054603249414300801451116017815902159146572436209664*i1^26
....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....:
....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....: ....:
....: ....:
1012629378133008045570223396268111873016080522054603249414300801451116017815902159146572436209664*x^26
+
410433527627442134308118298393342564356899007258029841287882737255835853884049174995159057694102920573747200*x^25
+
501494943106368931064497262537231425688088044453073779786147096541643930385166983233976016203651376921809329220852121600*x^24
-
644111856861065070866706525087980962518494168795535882970210317418977507771523793330182258788377809193026575862244588937805824000*x^23
+
19924407448746883912216721073318980086041378210199004111080024717375745417807953798733991147988720143895388439350128718933594147389440000*x^22
-
331371072860421205834083116262837202692691752472035902490617155218675792149554941144036688544674077637642745080147334984795364631694750515200000*x^21
+
2049712876434257587528902530951534114406510123534770838199001591149040200985153955268389232240212499713962733296299202327806997075399876196433920000000*x^20
-
7025259394914985023537560410179506117495296226061783298311047304126733767683332500692411463584846958339961977350118838859647625974149724354297819299840000000*x^19
+
10815601288653108660863718803498725333145395957746798702542184994173534597009611774372771721245769184996754028158132835031332463558108904175895492173181747200000000*x^18
-
7920657661346328516849663729933551966940189067473758528128786228728342737909655399359152717186692163201977219768061088078556576244522397147089917747732336869376000000000*x^17
+
2704263466440724763673019600029775165623071386021141657434785834092033407599191379221798097482965813066619946664401950353695134689638751295739555518753625253284413440000000000*x^16
-
743655179717315648408847727273753467171201293115039408736167509269910571278730908313802613474563508710939311612895559452283318993584503538008388945032561920510367734169600000000000*x^15
+
174128066474636339040468251199022844413910131388235902802651357105670999550310866544561172725633537026660188116703713702197111741946500688037944384258694561126973588763574272000000000000*x^14
+
5867629873133525139602740661293389148687535809186142469423758963783693568989291159182499553241195137899010397662697136940761634420038956221772211285150148829586825005530328596480000000000000*x^13
+
190893821910195783437104046267707195948674755680199148146705868373592804991712403182669273886408506303303003423730737922041242308788908870982844997014855211593187677984862800707584000000000000000*x^12
+
6716701065601380210100545970025344666144718133850671325025891235052150864344047553683076758757863399269458671558758355855458326738998435933269138482472116546974274283086234590921097216000000000000000*x^11
+
207945309923197227675066394920813581825473908934247588739515618804343576736081709076056978177837018217092693772146505845724503343162348632248309255642711748310752466973323126449861233213440000000000000000*x^10
+
3913181683651999237383556151030509326567625094606369073062492876717959656737362991811448719761936127356389404590392279701275686688334547586721653925980556331947809647149866809107334022823936000000000000000000*x^9
+
75164979846414113543014721937221377774789918745150707905320399106583691885453904110964557260667320981478056027569246959425808622997355463290946341656722085188899310506124978198222746057718104064000000000000000000*x^8
+
881054522285626541517785542148420250688543924427857527709534753295899811009105208652356737247996544458276153340176562728483906684871855873552445635627957227774649742144091721258895691523604820787200000000000000000000*x^7
+
11077342604533532525164090252320941615267509311333261074688160935771204008824783486355668815946618659325391586459706407800613824973226349002621729497752971963360336219028604043138670634200427191599104000000000000000000000*x^6
+
83854577222399022729090550461001938963657799535621113098887788754207755899629343668467056325038418901089451913134625030675149852634509566282127491809380290734179465166656517242795764550986198273186971648000000000000000000000*x^5
+
658259041485800976464302816116165215588236679873688147456723398511014527766003546546189637018719993970656294140752674263260405589667084004039725718906236759602716546087855161325790058548613293536926140838400000000000000000000000*x^4
+
2605913589677160923631578932221252754861605246045698298923254729863286128917018068286069560387433296812804379214195609656093433213817341016672860153066568159542474331872213113284682303721328193165639027164489675000000000000000000000*x^3
+
12100960474360844852430089655545281513402833676859514717108294878572637167944626649959989923111097779896784230770808939216097183999909581480028275696898705356370334583174123713781608169021012180602575703926423575264648437500000000000000*x^2
+
20518713450315039322056250166088677399879179929554356597510415893439402054648039918099259058046422019712028170247806685000018681797593217868525785092085046308791139713218965061698940798604284522971262298949676588165941352844238281250000000*x
+
64142895751684972523861209285243282417707075329583674916117055188381394775628232666253440274186493488594874737405053591961632429138669138467297304724926962706230467037061800892052686428670590014901138630952149649710687408091127872467041015625
sage: f = _
sage: f.roots(CC)
[(470361.820245868, 1),
(1.25177790453357e9, 1),
(-2.03298860112789e11 + 6.74115413126603e11*I, 1),
(-2.03298860112789e11 - 6.74115413126603e11*I, 1),
(1.16475054726688e7 + 1.30609589354525e7*I, 1),
(1.16475054726688e7 - 1.30609589354525e7*I, 1),
(2.78249805898164e6 + 2.98317202510733e6*I, 1),
(2.78249805898164e6 - 2.98317202510733e6*I, 1),
(996595.827928498 + 437557.094541233*I, 1),
(996595.827928498 - 437557.094541233*I, 1),
(-1630.61319607286 + 334060.449738135*I, 1),
(-1630.61319607286 - 334060.449738135*I, 1),
(12732.3063661902 + 25160.0301645502*I, 1),
(12732.3063661902 - 25160.0301645502*I, 1),
(-21504.3150468783 + 12109.1879518910*I, 1),
(-21504.3150468783 - 12109.1879518910*I, 1),
(-3658.06691532790 + 13146.4980245586*I, 1),
(-3658.06691532790 - 13146.4980245586*I, 1),
(1879.24848431825 + 12190.5599603421*I, 1),
(1879.24848431825 - 12190.5599603421*I, 1),
(-4469.59051158561 + 8416.93701866920*I, 1),
(-4469.59051158561 - 8416.93701866920*I, 1),
(-177.340482535130 + 3401.04786031455*I, 1),
(-177.340482535130 - 3401.04786031455*I, 1),
(-1581.01702889358 + 4447.86744726969*I, 1),
(-1581.01702889358 - 4447.86744726969*I, 1)]
sage: f.roots(QQbar, multiplicities=False)
---------------------------------------------------------------------------
LinAlgError Traceback (most recent call
last)
/Users/ncalexan/.sage/temp/mero.local/6993/_Users_ncalexan__sage_init_sage_0.py
in <module>()
----> 1
2
3
4
5
/Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
packages/sage/rings/polynomial/polynomial_element.so in
sage.rings.polynomial.polynomial_element.Polynomial.roots
(sage/rings/polynomial/polynomial_element.c:24158)()
3609
3610
-> 3611
3612
3613
/Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
packages/sage/rings/polynomial/complex_roots.py in complex_roots(p,
skip_squarefree, retval, min_prec)
321 for (factor, exp) in factors:
322 cfac = CCX(factor)
--> 323 rts = cfac.roots(multiplicities=False)
324 irts = interval_roots(factor, rts, max(prec,
min_prec))
325 if irts is None:
/Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
packages/sage/rings/polynomial/polynomial_element.so in
sage.rings.polynomial.polynomial_element.Polynomial.roots
(sage/rings/polynomial/polynomial_element.c:23239)()
3540
3541
-> 3542
3543
3544
/Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
packages/numpy/lib/polynomial.pyc in roots(p)
178 A = diag(NX.ones((N-2,), p.dtype), -1)
179 A[0, :] = -p[1:] / p[0]
--> 180 roots = _eigvals(A)
181 else:
182 roots = NX.array([])
/Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
packages/numpy/lib/polynomial.pyc in _eigvals(arg)
33 "Return the eigenvalues of the argument"
34 try:
---> 35 return eigvals(arg)
36 except TypeError:
37 get_linalg_funcs()
/Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
packages/numpy/linalg/linalg.pyc in eigvals(a)
595 _assertRank2(a)
596 _assertSquareness(a)
--> 597 _assertFinite(a)
598 t, result_t = _commonType(a)
599 real_t = _linalgRealType(t)
/Users/ncalexan/sage-3.2.1.alpha1/local/lib/python2.5/site-
packages/numpy/linalg/linalg.pyc in _assertFinite(*arrays)
123 for a in arrays:
124 if not (isfinite(a).all()):
--> 125 raise LinAlgError, "Array must not contain infs or
NaNs"
126
127 def _assertNonEmpty(*arrays):
LinAlgError: Array must not contain infs or NaNs
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4632#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---