Struct Complex
Source pub struct Complex {
pub re: f64,
pub im: f64,
}
Expand description
A complex number z = re + im·i.
Real part of the complex number.
Imaginary part of the complex number.
Inverse cosine: arccos(z) = -i * log(z + i*sqrt(1 - z^2)).
Is z approximately equal to w?
Argument: arg(z) ∈ (-π, π].
Convert to polar form (r, θ).
Inverse sine: arcsin(z) = -i * log(iz + sqrt(1 - z^2)).
Inverse tangent: arctan(z) = (i/2) * log((i+z)/(i-z)).
Complex cosine: cos(z) = (e^(iz) + e^(-iz)) / 2.
Complex tangent: tan(z) = sin(z)/cos(z).
Hyperbolic cosine: cosh(z) = (e^z + e^(-z)) / 2.
Create a new complex number.
Complex conjugate: a + bi → a - bi.
Multiplication: (a+bi)(c+di) = (ac-bd) + (ad+bc)i.
Complex exponential: exp(a+bi) = e^a * (cos b + i sin b).
Principal complex logarithm: log(z) = ln|z| + i·arg(z).
Complex sine: sin(z) = (e^(iz) - e^(-iz)) / (2i).
Polar form: (r, θ) → r·(cos θ + i·sin θ).
Modulus squared: |z|² = re² + im².
Division: z/w = z * conj(w) / |w|².
n-th roots of z: returns all n roots.
Complex power z^w = exp(w * log(z)).
Complex power z^n for integer n (fast exponentiation).
n-th roots of unity: e^(2πi·k/n) for k = 0..n-1.
Hyperbolic sine: sinh(z) = (e^z - e^(-z)) / 2.
Hyperbolic tangent: tanh(z) = sinh(z)/cosh(z).
The resulting type after applying the + operator.
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Formats the value using the given formatter.
Read more
The resulting type after applying the * operator.
The resulting type after applying the - operator.
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
The resulting type after applying the - operator.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The equivalence relation.
Reflexivity of the equivalence.
Symmetry: if self ~ other then other ~ self.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
Converts the given value to a
String.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.