Python supports creating complex numbers using the following syntax:

imagnumber ::= (floatnumber | intpart) ("j" | "J")

Right now, the preparser botches this and makes it give an error:

sage: 1j
------------------------------------------------------------
    File "<ipython console>", line 1
      Integer(1)j
                ^
SyntaxError: invalid syntax


Currently, if we use "raw" numbers, things work:

sage: 1rj
1j
sage: 1rj == complex('j')
True

However, the preparser probably ought to be fixed so that it supports 
the python syntax.  The ticket is:

http://trac.sagemath.org/sage_trac/ticket/4501

Mike Hansen detailed a possible fix that is noted on the ticket. 
However, it leaves a question open:

Should "1j" in Sage give a Sage complex number or a python complex 
number?  Giving a Sage complex number would probably be more consistent, 
with 1jr giving a python complex number.

Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to