I don’t know anything about the internals of the float package. For that you will have to contact it’s maintainer Laurent Bartholdi. See the package documentation for details.
I do observe though, that the imaginary parts of the roots are very small — less that 10^-7, so I imagine that the “correct” roots are very close together and rounding error is then shifting them off the real line. You could try setting a higher floating point precision. Steve > On 19 Apr 2015, at 04:36, Dr. Kashyap Rajeevsarathy <kash...@iiserb.ac.in> > wrote: > > Dear Forum, > > > Kindly disregard my earlier email: > > > I have been having some issues computing the roots of polynomials using > "RootsFloat" function of the "Float" package. Please consider the following > example: > > gap> a := last; > [ [ 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], > [ 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], > > [ 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ], > [ 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], > [ 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ], > [ 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], > [ 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], > [ 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], > [ 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], > [ 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], > [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0 ], > [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0 ], > [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0 ], > [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0 ], > [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1 ], > [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1 ], > [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0 ], > [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 ], > [ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1 ], > [ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 ] ] > > gap> a = TransposedMat(a); > true > gap> LoadPackage("float"); > Loading FLOAT 0.6.2 ... > true > gap> SetFloats(MPFR); > gap> pol := CharacteristicPolynomial(a); > x_1^20-40*x_1^18+610*x_1^16-8*x_1^15-4640*x_1^14+40*x_1^13+ > 19475*x_1^12-560*x_1^11-46380*x_1^10+5560*x_1^9+61610*x_1 > ^8-19600*x_1^7-42220*x_1^6+25784*x_1^5+8265*x_1^4-11560* > x_1^3+3700*x_1^2-400*x_1 > gap> coeff := CoefficientsOfUnivariatePolynomial(pol); > [ 0, -400, 3700, -11560, 8265, 25784, -42220, -19600, 61610, 5560, -46380, > -560, 19475, 40, -4640, -8, 610, 0, -40, 0, 1 ] > gap> RootsFloat(coeff*1.0); > [ .0e0, .381966e0, .381966e0, .618034e0+.218005e-7ⅈ, .618034e0-.218005e-7ⅈ, > .618034e0+.807401e-7ⅈ, .618034e0-.807401e-7ⅈ, -.138197e1, .2e1, -.138197e1, > -.161803e1, -.161803e1-.141802e-8ⅈ, .2e1, -.161803e1+.136277e-8ⅈ, > -.161803e1, .261803e1, .261803e1, -.361803e1, -.361803e1, .4e1 ] > Note that that the RootsFloat function is showing complex roots > (eigenvalues) for the characteristic polynomial of a real symmetric matrix. > > It would greatly help of you could me what's going wrong here. > > Best regards, > Kashyap > > > -- > Kashyap Rajeevsarathy > Assistant Professor, > Indian Institute of Science Education and Research (IISER) Bhopal, > Indore By-pass Road, > Bhauri, Bhopal - 462066, > Madhya Pradesh, India. > Phone: +91-755-669-2364 > Website: https://home.iiserb.ac.in/~kashyap > _______________________________________________ > Forum mailing list > Forum@mail.gap-system.org > http://mail.gap-system.org/mailman/listinfo/forum _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum