This module implements complex numbers.
Procs
proc toComplex[SomeInteger](x: SomeInteger): Complex
- Convert some integer x to a complex number. Source Edit
proc `==`(x, y: Complex): bool {.
raises: [], tags: [].}- Compare two complex numbers x and y for equality. Source Edit
proc `=~`(x, y: Complex): bool {.
raises: [], tags: [].}- Compare two complex numbers x and y approximately. Source Edit
proc `+`(x, y: Complex): Complex {.
raises: [], tags: [].}- Add two complex numbers. Source Edit
proc `+`(x: Complex; y: float): Complex {.
raises: [], tags: [].}- Add complex x to float y. Source Edit
proc `+`(x: float; y: Complex): Complex {.
raises: [], tags: [].}- Add float x to complex y. Source Edit
proc `-`(z: Complex): Complex {.
raises: [], tags: [].}- Unary minus for complex numbers. Source Edit
proc `-`(x, y: Complex): Complex {.
raises: [], tags: [].}- Subtract two complex numbers. Source Edit
proc `-`(x: Complex; y: float): Complex {.
raises: [], tags: [].}- Subtracts float y from complex x. Source Edit
proc `-`(x: float; y: Complex): Complex {.
raises: [], tags: [].}- Subtracts complex y from float x. Source Edit
proc `/`(x, y: Complex): Complex {.
raises: [], tags: [].}- Divide x by y. Source Edit
proc `/`(x: Complex; y: float): Complex {.
raises: [], tags: [].}- Divide complex x by float y. Source Edit
proc `/`(x: float; y: Complex): Complex {.
raises: [], tags: [].}- Divide float x by complex y. Source Edit
proc `*`(x, y: Complex): Complex {.
raises: [], tags: [].}- Multiply x with y. Source Edit
proc `*`(x: float; y: Complex): Complex {.
raises: [], tags: [].}- Multiply float x with complex y. Source Edit
proc `*`(x: Complex; y: float): Complex {.
raises: [], tags: [].}- Multiply complex x with float y. Source Edit
proc `+=`(x: var Complex; y: Complex) {.
raises: [], tags: [].}- Add y to x. Source Edit
proc `+=`(x: var Complex; y: float) {.
raises: [], tags: [].}- Add y to the complex number x. Source Edit
proc `-=`(x: var Complex; y: Complex) {.
raises: [], tags: [].}- Subtract y from x. Source Edit
proc `-=`(x: var Complex; y: float) {.
raises: [], tags: [].}- Subtract y from the complex number x. Source Edit
proc `*=`(x: var Complex; y: Complex) {.
raises: [], tags: [].}- Multiply y to x. Source Edit
proc `*=`(x: var Complex; y: float) {.
raises: [], tags: [].}- Multiply y to the complex number x. Source Edit
proc `/=`(x: var Complex; y: Complex) {.
raises: [], tags: [].}- Divide x by y in place. Source Edit
proc `/=`(x: var Complex; y: float) {.
raises: [], tags: [].}- Divide complex x by float y in place. Source Edit
proc abs(z: Complex): float {.
raises: [], tags: [].}- Return the distance from (0,0) to z. Source Edit
proc conjugate(z: Complex): Complex {.
raises: [], tags: [].}- Conjugate of complex number z. Source Edit
proc sqrt(z: Complex): Complex {.
raises: [], tags: [].}- Square root for a complex number z. Source Edit
proc exp(z: Complex): Complex {.
raises: [], tags: [].}- e raised to the power z. Source Edit
proc ln(z: Complex): Complex {.
raises: [], tags: [].}- Returns the natural log of z. Source Edit
proc log10(z: Complex): Complex {.
raises: [], tags: [].}- Returns the log base 10 of z. Source Edit
proc log2(z: Complex): Complex {.
raises: [], tags: [].}- Returns the log base 2 of z. Source Edit
proc pow(x, y: Complex): Complex {.
raises: [], tags: [].}- x raised to the power y. Source Edit
proc sin(z: Complex): Complex {.
raises: [], tags: [].}- Returns the sine of z. Source Edit
proc arcsin(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse sine of z. Source Edit
proc cos(z: Complex): Complex {.
raises: [], tags: [].}- Returns the cosine of z. Source Edit
proc arccos(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse cosine of z. Source Edit
proc tan(z: Complex): Complex {.
raises: [], tags: [].}- Returns the tangent of z. Source Edit
proc arctan(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse tangent of z. Source Edit
proc cot(z: Complex): Complex {.
raises: [], tags: [].}- Returns the cotangent of z. Source Edit
proc arccot(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse cotangent of z. Source Edit
proc sec(z: Complex): Complex {.
raises: [], tags: [].}- Returns the secant of z. Source Edit
proc arcsec(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse secant of z. Source Edit
proc csc(z: Complex): Complex {.
raises: [], tags: [].}- Returns the cosecant of z. Source Edit
proc arccsc(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse cosecant of z. Source Edit
proc sinh(z: Complex): Complex {.
raises: [], tags: [].}- Returns the hyperbolic sine of z. Source Edit
proc arcsinh(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse hyperbolic sine of z. Source Edit
proc cosh(z: Complex): Complex {.
raises: [], tags: [].}- Returns the hyperbolic cosine of z. Source Edit
proc arccosh(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse hyperbolic cosine of z. Source Edit
proc tanh(z: Complex): Complex {.
raises: [], tags: [].}- Returns the hyperbolic tangent of z. Source Edit
proc arctanh(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse hyperbolic tangent of z. Source Edit
proc sech(z: Complex): Complex {.
raises: [], tags: [].}- Returns the hyperbolic secant of z. Source Edit
proc arcsech(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse hyperbolic secant of z. Source Edit
proc csch(z: Complex): Complex {.
raises: [], tags: [].}- Returns the hyperbolic cosecant of z. Source Edit
proc arccsch(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse hyperbolic cosecant of z. Source Edit
proc coth(z: Complex): Complex {.
raises: [], tags: [].}- Returns the hyperbolic cotangent of z. Source Edit
proc arccoth(z: Complex): Complex {.
raises: [], tags: [].}- Returns the inverse hyperbolic cotangent of z. Source Edit
proc phase(z: Complex): float {.
raises: [], tags: [].}- Returns the phase of z. Source Edit
proc polar(z: Complex): tuple[r, phi: float] {.
raises: [], tags: [].}- Returns z in polar coordinates. Source Edit
proc rect(r: float; phi: float): Complex {.
raises: [], tags: [].}- Returns the complex number with polar coordinates r and phi. Source Edit
proc `$`(z: Complex): string {.
raises: [], tags: [].}- Returns z's string representation as "(re, im)". Source Edit