X
xah
#python supports complex numbers.
# append a "j" to a number and it represents the imaginary number. e.g.
# 3j means 3*i.
#(3,4) can be written as 3+4j
#another way to write is is
#complex(3,4)
#arithmetic operations can be applied normally.
# to get the real part, imaginary part, or length, one can do
a=complex(3,4)
print a.real
print a.imag
print abs(a)
print complex(3,4)+5+6j
----------------
# Perl doesn't support complex numbers. But there are packages that
supports it.
Xah
(e-mail address removed)
http://xahlee.org/PageTwo_dir/more.html
# append a "j" to a number and it represents the imaginary number. e.g.
# 3j means 3*i.
#(3,4) can be written as 3+4j
#another way to write is is
#complex(3,4)
#arithmetic operations can be applied normally.
# to get the real part, imaginary part, or length, one can do
a=complex(3,4)
print a.real
print a.imag
print abs(a)
print complex(3,4)+5+6j
----------------
# Perl doesn't support complex numbers. But there are packages that
supports it.
Xah
(e-mail address removed)
http://xahlee.org/PageTwo_dir/more.html