Complex

A class for working with imaginary numbers.

Constructors

this
this()

Constructs an initialized Float.

this
this(Complex c)

Constructs from a Complex.

this
this(Float r, Float i = null)

Constructs from two Floats.

this
this(long r, long i = 0)

Constructs from two longs.

this
this(ulong r, ulong i = 0)

Constructs from two ulongs.

this
this(double r, double i = 0)

Constructs from two longs.

this
this(cstring r, cstring i)

Constructs from two strings.

this
this(cstring x)

Constructs from a string.

this
this(cchar* x)

Constructs a Complex from a zero-terminated string.

Members

Aliases

mag
alias mag = re

The length or magnitude of the vector.

phi
alias phi = im

The angle of the vector.

Functions

abs
Float abs()

Returns the absolute value: |z| = √(re² + im²).

arg
Float arg()

Returns the polar angle: φ = arctan(b/a).

cart
Complex cart()

Converts this number to cartesian representation. Returns itself.

clear
void clear()

Clears this number and deallocates its data.

conjugate
Complex conjugate()

Conjugates this number: conj(z) = Re(z) - Im(z). Returns itself.

conjugated
Complex conjugated()

Returns a conjugated copy of this number.

dup
Complex dup()

Returns a deep copy of this number.

exp
Complex exp()

Calculates e^z. Returns itself.

fraction
Complex fraction()

Calculates frac(z). Returns itself.

inverse
Complex inverse()

Inverses this number: z = z^-1. Returns itself.

inversed
Complex inversed()

Returns an inversed copy of this number.

ln
Complex ln()

Calculates ln(z). Returns itself.

logz
Complex logz(Complex w)

Calculates loga+bi(w) = ln(w)/ln(a+bi). Returns a new number.

neg
Complex neg()

Negates this number. Returns itself.

opAdd
Complex opAdd(Complex x)
Complex opAdd(uint x)

Calculates z+x. Returns a new number.

opAddAssign
Complex opAddAssign(Complex x)

Calculates z += x. Returns itself.

opDiv
Complex opDiv(T x)

Calculates z/x. Returns a new number.

opDivAssign
Complex opDivAssign(T x)
Complex opDivAssign(T x)

Calculates z /= x. Returns itself.

opDiv_r
Complex opDiv_r(uint x)
Complex opDiv_r(double x)
Complex opDiv_r(cstring x)
Complex opDiv_r(cchar* x)

Calculates x/z. Returns a new number.

opEquals
bool opEquals(Object x)

Compares z to x.

opEquals
bool opEquals(Complex x)

Compares z to x.

opMod
Complex opMod(Complex w)

Calculates z % w. Returns a new number.

opMod
Complex opMod(Float f)

Calculates z % f. Returns a new number.

opModAssign
Complex opModAssign(Complex w)

Calculates z %= w. Returns itself.

opModAssign
Complex opModAssign(Float f)

Calculates z %= f. Returns itself.

opMul
Complex opMul(T x)

Calculates z*x. Returns a new number.

opMulAssign
Complex opMulAssign(T x)
Complex opMulAssign(T x)

Calculates z *= x. Returns itself.

opNeg
Complex opNeg()

Returns a negated copy of this number.

opSub
Complex opSub(T x)

Calculates z-x. Returns a new number.

opSubAssign
Complex opSubAssign(Complex x)
Complex opSubAssign(uint x)

Calculates z -= x. Returns itself.

polar
Complex polar()

Converts this number to polar representation. Returns itself.

pow
Complex pow(T w)

Calculates z^w. Returns itself.

pow
Complex pow(T x)

Calculates z^x. Returns itself.

set
Complex set(cchar* x)

Parses the string and sets the real and imaginary parts. Returns itself.

sqrt
Complex sqrt()

Calculates √z. Returns itself.

toString
string toString()

Returns this number as a string.

toString
char[] toString(uint precision)

Returns this number as a string.

Static functions

opCall
Complex opCall(Params P)

For convenient construction of Complex numbers.

Variables

im
Float im;

The imaginary part.

re
Float re;

The real part.

Meta