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)


> Also annoying but less odd is that the error handling in plot doesn't
> deal well with
>
> plot(Zeta,1,20)
>
> presumably because PariError is not one of the error types excepted at
> e.g. asymptotes.

That Zeta ever raises PariError might as well be considered a bug.
(It's more a "nobody got to making things better" issue.)  You might
use some exception handling in your definition of Zeta.

 -- William

> I guess the point of this is asking whether there is something obvious
> I am missing here, and if not, whether this is a bug or just something
> I have to deal with.  Not that the real plot of zeta is so exciting to
> look at!
>
> Thanks!
> - kcrisman
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to