` On Wed, Sep 24, 2008 at 4:42 AM, John Cremona <[EMAIL PROTECTED]> wrote: > > 2008/9/24 mabshoff <[EMAIL PROTECTED]>: >> >> >> >> On Sep 24, 4:15 am, Raouf <[EMAIL PROTECTED]> wrote: >>> Hi, >>> I want to have a numerical value of a Dirichlet character : >>> >>> I have this line code in my notebook: >>> >>> sage: >>> G = DirichletGroup(21) >>> chi = G.1; >>> chi(23) >>> >>> evaluate: >>> zeta6 - 1 >>> >>> And when i want to use this value: zeta6 - 1 i have the error message: >>> >>> G = DirichletGroup(21) >>> chi = G.1; >>> chi(23) >>> B=13*chi(23) >>> print float(B) >>> >>> error message: >>> >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File "/home/server2/nb1/sage_notebook/worksheets/fstthese/0/code/ >>> 6.py", line 10, in <module> >>> print float(B) >>> File "/home/server2/sage/local/lib/python2.5/site-packages/ >>> SQLAlchemy-0.4.6-py2.5.egg/", line 1, in <module> >>> >>> TypeError: float() argument must be a string or a number. >> >> Looks like a bug to me. The usual trick (at least in my book of using >> n() does also not work): >> >> [EMAIL PROTECTED]:/scratch/mabshoff/release-cycle/sage-3.1.3.alpha1$ ./ >> sage >> ---------------------------------------------------------------------- >> | SAGE Version 3.1.3.alpha1, Release Date: 2008-09-24 | >> | Type notebook() for the GUI, and license() for information. | >> ---------------------------------------------------------------------- >> >> sage: G = DirichletGroup(21) >> sage: chi = G.1; >> sage: chi(23) >> zeta6 - 1 >> sage: B=13*chi(23) >> sage: print float(B)
B cannot be be coerced to a float, since B is a complex number with nontrivial imaginary part. It definitely should raise a TypeError as it does. That said, it would be good to make it so this works, which would be a good thing to open as a ticket. sage: G = DirichletGroup(21) sage: B = 23* G.1(23) sage: B 23*zeta6 - 23 sage: complex(B) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---