4.3.4.1 ComplexNumber Objects

class ComplexNumber
A complex number.
ComplexNumber( real, [imag=0], [prec=None])

Instances of class ComplexNumber have the following methods (in addition to inherited methods and special methods):

arg,$  $ argument,$  $ conjugate,$  $ exp,$  $ imag,$  $ log,$  $ norm,$  $ order,$  $ pari,$  $ prec,$  $ real,$  $ sqrt

These methods are defined as follows:

arg( )

Same as argument.

argument( )

The argument (angle) of the complex number, normalized so that -pi < arg <= pi.

WARNING: We use the floating point atan function, so there is precision loss.

conjugate( )

exp( [prec=None])

Compute exp(z) using Fourier series.

If prec is given, compute until the nth summand is less than $ 10^{-prec}$ .

imag( )

log( )

Complex logarithm of z with branch chosen as follows: Write z = rho*exp(i*theta) with -pi <= theta < pi. Then log(z) = log(rho) + i*theta.

WARNING: Currently the real log is computed using floats, so there is potential precision loss.

norm( )

order( )

pari( )

prec( )

real( )

sqrt( )

Instances of class ComplexNumber also have the following special methods:

__abs__( )

__add__( right)

__cmp__( other)

__complex__( )

__div__( right)

__float__( )

__int__( )

__invert__( )

__long__( )

__mul__( right)

__neg__( )

__pos__( )

__pow__( right)

__radd__( left)

__rdiv__( left)

__rmul__( left)

__rsub__( left)

__sub__( right)

See About this document... for information on suggesting changes.