Module complex

This module implements complex numbers.

Types

TComplex* = tuple[re, im: float]
a complex number, consisting of a real and an imaginary part

Procs

proc `==`*(x, y: TComplex): bool
Compare two complex numbers x and y for equality.
proc `=~`*(x, y: TComplex): bool
Compare two complex numbers x and y approximately.
proc `+`*(x, y: TComplex): TComplex
Add two complex numbers.
proc `+`*(x: TComplex; y: float): TComplex
Add complex x to float y.
proc `+`*(x: float; y: TComplex): TComplex
Add float x to complex y.
proc `-`*(z: TComplex): TComplex
Unary minus for complex numbers.
proc `-`*(x, y: TComplex): TComplex
Subtract two complex numbers.
proc `-`*(x: TComplex; y: float): TComplex
Subtracts float y from complex x.
proc `-`*(x: float; y: TComplex): TComplex
Subtracts complex y from float x.
proc `/`*(x, y: TComplex): TComplex
Divide x by y.
proc `/`*(x: TComplex; y: float): TComplex
Divide complex x by float y.
proc `/`*(x: float; y: TComplex): TComplex
Divide float x by complex y.
proc `*`*(x, y: TComplex): TComplex
Multiply x with y.
proc `*`*(x: float; y: TComplex): TComplex
Multiply float x with complex y.
proc `*`*(x: TComplex; y: float): TComplex
Multiply complex x with float y.
proc abs*(z: TComplex): float
Return the distance from (0,0) to z.
proc sqrt*(z: TComplex): TComplex
Square root for a complex number z.
proc exp*(z: TComplex): TComplex
e raised to the power z.
proc ln*(z: TComplex): TComplex
Returns the natural log of z.
proc log10*(z: TComplex): TComplex
Returns the log base 10 of z.
proc log2*(z: TComplex): TComplex
Returns the log base 2 of z.
proc pow*(x, y: TComplex): TComplex
x raised to the power y.
proc sin*(z: TComplex): TComplex
Returns the sine of z.
proc arcsin*(z: TComplex): TComplex
Returns the inverse sine of z.
proc cos*(z: TComplex): TComplex
Returns the cosine of z.
proc arccos*(z: TComplex): TComplex
Returns the inverse cosine of z.
proc tan*(z: TComplex): TComplex
Returns the tangent of z.
proc cot*(z: TComplex): TComplex
Returns the cotangent of z.
proc sec*(z: TComplex): TComplex
Returns the secant of z.
proc csc*(z: TComplex): TComplex
Returns the cosecant of z.
proc sinh*(z: TComplex): TComplex
Returns the hyperbolic sine of z.
proc cosh*(z: TComplex): TComplex
Returns the hyperbolic cosine of z.
proc `$`*(z: TComplex): string
Returns z's string representation as "(re, im)".
Generated: 2012-09-23 21:47:54 UTC