Skip to content

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

jule
struct Cmplx {
	// NOTE: contains filtered hidden or unexported fields
}

Complex number.

New

jule
static fn New(real: f64, imag: f64): Cmplx

Returns new complex number.

NaN

jule
static fn NaN(): Cmplx

Returns NaN complex number.

Inf

jule
static fn Inf(sign: int): Cmplx

Returns Inf complex number. Uses positive infinity if sign >= 0, negative infinity if !sign < 0.

Zero

jule
static fn Zero(): Cmplx

Returns zero complex number.

Rect

jule
static fn Rect(r: f64, theta: f64): Cmplx

Returns the complex number with polar coordinates r, θ.

Sin

jule
fn Sin(self): Cmplx

Returns the sine of complex number.

Sinh

jule
fn Sinh(self): Cmplx

Returns the hyperbolic sine of complex number.

Cos

jule
fn Cos(self): Cmplx

Returns the cosine of complex number.

Cosh

jule
fn Cosh(self): Cmplx

Returns the hyperbolic cosine of complex number.

Tan

jule
fn Tan(self): Cmplx

Returns the tangent of complex number.

Tanh

jule
fn Tanh(self): Cmplx

Returns the hyperbolic tangent of complex number.

Cot

jule
fn Cot(self): Cmplx

Returns the cotangent of complex number.

Real

jule
fn Real(self): f64

Returns real part of complex number.

Imag

jule
fn Imag(self): f64

Returns imaginary part of complex number.

Conj

jule
fn Conj(self): Cmplx

Returns conjugate of complex number.

Add

jule
fn Add(self, c: Cmplx): Cmplx

Returns addition of complex numbers.

Sub

jule
fn Sub(self, c: Cmplx): Cmplx

Returns subtraction of complex numbers.

Mul

jule
fn Mul(self, c: Cmplx): Cmplx

Returns multiplication of complex numbers.

Div

jule
fn Div(self, c: Cmplx): Cmplx

Returns division of complex numbers. Returns NaN complex number if denominator is zero.

Neg

jule
fn Neg(self): Cmplx

Unary minus operator.

IsInf

jule
fn IsInf(self): bool

Reports whether either real or imag is an infinity.

IsNaN

jule
fn IsNaN(self): bool

Reports whether either real or imag is NaN and neither is an infinity.

IsZero

jule
fn IsZero(self): bool

Reports whether real and imag is zero.

Log

jule
fn Log(self): Cmplx

Returns the natural logarithm of complex number.

Log10

jule
fn Log10(self): Cmplx

Returns the decimal logarithm of complex number.

Abs

jule
fn Abs(self): f64

Returns the absolute value (also called the modulus) of x.

Pow

jule
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

jule
fn Exp(self): Cmplx

Returns e**x, the base-e exponential of x.

Sqrt

jule
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

jule
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

jule
fn Phase(self): f64

Phase returns the phase (also called the argument) of x. The returned value is in the range [-PI, PI].

Asin

jule
fn Asin(self): Cmplx

Returns the inverse sine of complex number.

Asinh

jule
fn Asinh(self): Cmplx

Returns the inverse hyperbolic sine of complex number.

Acos

jule
fn Acos(self): Cmplx

Returns the inverse cosine of complex number.

Acosh

jule
fn Acosh(self): Cmplx

Returns the inverse hyperbolic cosine of complex number.

Atan

jule
fn Atan(self): Cmplx

Returns the inverse tangent of complex number.

Atanh

jule
fn Atanh(self): Cmplx

Returns the inverse hyperbolic tangent of complex number.