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