Le vendredi 12 avril 2019 22:06:34 UTC+2, David Roe a écrit :
>
> I realized that you may be just looking for the Python complex type.  To 
> get that you can do:
> sage: j = complex(i)
> sage: (3 + 4*j)^2
> (-7+24j)
>

The imaginary unit of Python's complex numbers displays
(and is input) as 1j. To use these numbers in Sage either
disable the Sage preparser:

    sage: preparser(False)
    sage: a = 1j
    sage: a
    1j
    sage: a*a
    (-1+0j)
    sage: (1 + 1j) * (3 + 2j)
    (1+5j)

or append "r" (for "raw") to the numbers you input.

    sage: preparser(True)
    sage: (1 + 1j) * (3 + 2j)
    1.00000000000000 + 5.00000000000000*I
    sage: (1r + 1jr) * (3r + 2jr)
    (1+5j)


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to