std/math/cmplx
Index
struct Cmplx
static fn New(real: f64, imag: f64): Cmplx
static fn NaN(): Cmplx
static fn Inf(sign: int): Cmplx
static fn Zero(): Cmplx
static fn Rect(r: f64, theta: f64): Cmplx
fn Sin(self): Cmplx
fn Sinh(self): Cmplx
fn Cos(self): Cmplx
fn Cosh(self): Cmplx
fn Tan(self): Cmplx
fn Tanh(self): Cmplx
fn Cot(self): Cmplx
fn Real(self): f64
fn Imag(self): f64
fn Conj(self): Cmplx
fn Add(self, c: Cmplx): Cmplx
fn Sub(self, c: Cmplx): Cmplx
fn Mul(self, c: Cmplx): Cmplx
fn Div(self, c: Cmplx): Cmplx
fn Neg(self): Cmplx
fn IsInf(self): bool
fn IsNaN(self): bool
fn IsZero(self): bool
fn Log(self): Cmplx
fn Log10(self): Cmplx
fn Abs(self): f64
fn Pow(self, y: Cmplx): Cmplx
fn Exp(self): Cmplx
fn Sqrt(self): Cmplx
fn Polar(self): (r: f64, theta: f64)
fn Phase(self): f64
fn Asin(self): Cmplx
fn Asinh(self): Cmplx
fn Acos(self): Cmplx
fn Acosh(self): Cmplx
fn Atan(self): Cmplx
fn Atanh(self): Cmplx
Cmplx
struct Cmplx {
// NOTE: contains filtered hidden or unexported fields
}
Complex number.
New
static fn New(real: f64, imag: f64): Cmplx
Returns new complex number.
NaN
static fn NaN(): Cmplx
Returns NaN complex number.
Inf
static fn Inf(sign: int): Cmplx
Returns Inf complex number. Uses positive infinity if sign >= 0, negative infinity if !sign < 0.
Zero
static fn Zero(): Cmplx
Returns zero complex number.
Rect
static fn Rect(r: f64, theta: f64): Cmplx
Returns the complex number with polar coordinates r, θ.
Sin
fn Sin(self): Cmplx
Returns the sine of complex number.
Sinh
fn Sinh(self): Cmplx
Returns the hyperbolic sine of complex number.
Cos
fn Cos(self): Cmplx
Returns the cosine of complex number.
Cosh
fn Cosh(self): Cmplx
Returns the hyperbolic cosine of complex number.
Tan
fn Tan(self): Cmplx
Returns the tangent of complex number.
Tanh
fn Tanh(self): Cmplx
Returns the hyperbolic tangent of complex number.
Cot
fn Cot(self): Cmplx
Returns the cotangent of complex number.
Real
fn Real(self): f64
Returns real part of complex number.
Imag
fn Imag(self): f64
Returns imaginary part of complex number.
Conj
fn Conj(self): Cmplx
Returns conjugate of complex number.
Add
fn Add(self, c: Cmplx): Cmplx
Returns addition of complex numbers.
Sub
fn Sub(self, c: Cmplx): Cmplx
Returns subtraction of complex numbers.
Mul
fn Mul(self, c: Cmplx): Cmplx
Returns multiplication of complex numbers.
Div
fn Div(self, c: Cmplx): Cmplx
Returns division of complex numbers. Returns NaN complex number if denominator is zero.
Neg
fn Neg(self): Cmplx
Unary minus operator.
IsInf
fn IsInf(self): bool
Reports whether either real or imag is an infinity.
IsNaN
fn IsNaN(self): bool
Reports whether either real or imag is NaN and neither is an infinity.
IsZero
fn IsZero(self): bool
Reports whether real and imag is zero.
Log
fn Log(self): Cmplx
Returns the natural logarithm of complex number.
Log10
fn Log10(self): Cmplx
Returns the decimal logarithm of complex number.
Abs
fn Abs(self): f64
Returns the absolute value (also called the modulus) of x.
Pow
fn Pow(self, y: Cmplx): Cmplx
Returns x**y, the base-x (self) exponential of y. For generalized compatibility with math::pow:
Pow(0, ±0) returns 1+0i
Pow(0, c) for c.Real()<0 returns Inf+0i if c.Imag() is zero, otherwise Inf+Inf i.
Exp
fn Exp(self): Cmplx
Returns e**x, the base-e exponential of x.
Sqrt
fn Sqrt(self): Cmplx
Returns the square root of complex number. The result r is chosen so that r.real() ≥ 0 and r.imag() has the same sign as self.imag().
Polar
fn Polar(self): (r: f64, theta: f64)
Polar returns the absolute value r and phase θ of x, such that x = r * e**θi. The phase is in the range [-PI, PI].
Phase
fn Phase(self): f64
Phase returns the phase (also called the argument) of x. The returned value is in the range [-PI, PI].
Asin
fn Asin(self): Cmplx
Returns the inverse sine of complex number.
Asinh
fn Asinh(self): Cmplx
Returns the inverse hyperbolic sine of complex number.
Acos
fn Acos(self): Cmplx
Returns the inverse cosine of complex number.
Acosh
fn Acosh(self): Cmplx
Returns the inverse hyperbolic cosine of complex number.
Atan
fn Atan(self): Cmplx
Returns the inverse tangent of complex number.
Atanh
fn Atanh(self): Cmplx
Returns the inverse hyperbolic tangent of complex number.