Something strange (at least for me). I am computing with polynomials in QQbar[z]. So I do:
sage: P.<z>=QQbar[] And I define 2 polynomials N and D. Coefficients of N and D are all real, algebraic numbers (say like QQbar(sqrt(3))) and I consider the rational fraction R=N/D sage: R.parent() Fraction Field of Univariate Polynomial Ring in z over Algebraic Field Now, I want to look at R on the imaginary axis. I do (may be this is not a good idea): sage: PP.<x>=QQbar[] sage: RIaxe=R(z=QQbar(I)*x) sage: RIaxe.parent() Fraction Field of Univariate Polynomial Ring in x over Algebraic Field it seems ok. I take the numerator: sage: pp=RIaxe.numerator() sage: print pp 0.05638275005921478?*I*x^3 - 0.4022786138875136?*x^2 - 1/2*I*x + 1 okay. sage: pp.parent() Univariate Polynomial Ring in x over Algebraic Field okay. ----- Now starts my problem; I want to extract from pp the polynomial which has real coefficients: sage: l=[s for s in pp.coefficients() if s.imag()==0] sage: print l [1, -0.4022786138875136?] 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? ---------------------- Now if I use the radical_expression method: sage: l=[QQbar(pp.coefficients()[i].radical_expression())*x^i for i in range(0,pp.degree()+1) if pp.coefficients()[i].imag()==0] sage: -0.4022786138875136?*x^2 + 1 which is ok, (but... a bit slow). Why ? Yours, t. -- 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.
<<attachment: tdumont.vcf>>