On Monday, November 7, 2016 at 5:59:14 AM UTC-8, tdumont wrote: > > > okay. Now let us construct a polynomial from l: > sage: print sum([l[i]*z^i for i in range(0,len(l))]) > (-0.4022786138875136? + 0.?e-18*I)*z + 1 > ^^^^^ > Why? an imaginary part? > ---------------------- > There are polynomials for which this doesn't happen. It would be better to include enough information to reproduce your observations.
The representation you see is a float approximation to the algebraic number. You can approximate real numbers quite well with complex numbers with non-zero imaginary part. sage: P.<x>=QQbar[] sage: u=[u for u in (x^3+x+1).roots(multiplicities=false) if u.imag()==0][0] sage: u -0.6823278038280193? sage: v=(u*QQbar.zeta(8))^4; v -0.2167565719512513? + 0.?e-18*I sage: v.imag() == 0 True sage: v._exact_value() a^4 where a^12 + 2*a^8 + 5*a^4 + 1 = 0 and a in 0.4824786170789168? - 0.4824786170789168?*I sage: v.simplify() sage: v -0.2167565719512513? sage: v._exact_value() a^2 - a where a^3 + a - 1 = 0 and a in 0.6823278038280193? sage: v.minpoly() x^3 + 2*x^2 + 5*x + 1 sage: v.minpoly().roots(QQbar) [(-0.2167565719512513?, 1), (-0.891621714024375? - 1.954093392512700?*I, 1), (-0.891621714024375? + 1.954093392512700?*I, 1)] (I have seen cases where "simplify" didn't do the trick, but recomputing the algebraic number by taking the roots of the minimal polynomial did) -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.