The cmath module

This module contains a number of mathematical operations for complex numbers.

Example: Using the cmath module
# File: cmath-example-1.py

import cmath

print "pi", "=>", cmath.pi
print "sqrt(-1)", "=>", cmath.sqrt(-1)

pi => 3.14159265359
sqrt(-1) => 1j

See the Python Library Reference for a full list of functions.

 

[comment on/vote for this article]

A Django site. this page was rendered by a django application in 0.01s 2008-08-30 06:58:01.241946. hosted by webfaction.