On May 4, 2009, at 12:22 PM, William Stein wrote: > On Mon, May 4, 2009 at 12:02 PM, kcrisman <kcris...@gmail.com> wrote: >> >> In order to plot zeta for real input, I have to do the following: >> def Zeta(x): >> return RR(zeta(x)) >> plot(Zeta,2,20) >> >> This is because >> sage: zeta(2) >> 1.64493406684823 >> sage: type(zeta(2)) >> <type 'sage.rings.complex_number.ComplexNumber'> >> >> which seems odd to me that pure real complex number won't coerce to >> the real field, or to float (which is what plot wants). > > This is a Python design decision. Note that in pure Python it is the > same. Sage remains consistent with this Python design decision. > > sage: float(complex(1,0)) > TypeError: can't convert complex to float; use abs(z)
I still think this is a bad design decision that is inconsistent with the rest of Sage and we should do differently... - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---