Struct num::Complex []

pub struct Complex<T> {
    pub re: T,
    pub im: T,
}

A complex number in Cartesian form.

Fields

Real portion of the complex number

Imaginary portion of the complex number

Methods

impl<T> Complex<T> where T: Clone + Num

Create a new Complex

Returns imaginary unit

Returns the square of the norm (since T doesn't necessarily have a sqrt function), i.e. re^2 + im^2.

Multiplies self by the scalar t.

Divides self by the scalar t.

impl<T> Complex<T> where T: Neg<Output=T> + Clone + Num

Returns the complex conjugate. i.e. re - i im

Returns 1/self

impl<T> Complex<T> where T: Clone + Float

Calculate |self|

Calculate the principal Arg of self.

Convert to polar form (r, theta), such that self = r * exp(i * theta)

Convert a polar representation into a complex number.

Computes e^(self), where e is the base of the natural logarithm.

Computes the principal value of natural logarithm of self.

This function has one branch cut:

  • (-∞, 0], continuous from above.

The branch satisfies -π ≤ arg(ln(z)) ≤ π.

Computes the principal value of the square root of self.

This function has one branch cut:

  • (-∞, 0), continuous from above.

The branch satisfies -π/2 ≤ arg(sqrt(z)) ≤ π/2.

Raises self to a floating point power.

Returns the logarithm of self with respect to an arbitrary base.

Raises self to a complex power.

Raises a floating point number to the complex power self.

Computes the sine of self.

Computes the cosine of self.

Computes the tangent of self.

Computes the principal value of the inverse sine of self.

This function has two branch cuts:

  • (-∞, -1), continuous from above.
  • (1, ∞), continuous from below.

The branch satisfies -π/2 ≤ Re(asin(z)) ≤ π/2.

Computes the principal value of the inverse cosine of self.

This function has two branch cuts:

  • (-∞, -1), continuous from above.
  • (1, ∞), continuous from below.

The branch satisfies 0 ≤ Re(acos(z)) ≤ π.

Computes the principal value of the inverse tangent of self.

This function has two branch cuts:

  • (-∞i, -i], continuous from the left.
  • [i, ∞i), continuous from the right.

The branch satisfies -π/2 ≤ Re(atan(z)) ≤ π/2.

Computes the hyperbolic sine of self.

Computes the hyperbolic cosine of self.

Computes the hyperbolic tangent of self.

Computes the principal value of inverse hyperbolic sine of self.

This function has two branch cuts:

  • (-∞i, -i), continuous from the left.
  • (i, ∞i), continuous from the right.

The branch satisfies -π/2 ≤ Im(asinh(z)) ≤ π/2.

Computes the principal value of inverse hyperbolic cosine of self.

This function has one branch cut:

  • (-∞, 1), continuous from above.

The branch satisfies -π ≤ Im(acosh(z)) ≤ π and 0 ≤ Re(acosh(z)) < ∞.

Computes the principal value of inverse hyperbolic tangent of self.

This function has two branch cuts:

  • (-∞, -1], continuous from above.
  • [1, ∞), continuous from below.

The branch satisfies -π/2 ≤ Im(atanh(z)) ≤ π/2.

Checks if the given complex number is NaN

Checks if the given complex number is infinite

Checks if the given complex number is finite

Checks if the given complex number is normal

Trait Implementations

impl<T> Encodable for Complex<T> where T: Encodable

impl<T> Decodable for Complex<T> where T: Decodable

impl<T> PartialEq<Complex<T>> for Complex<T> where T: PartialEq<T>

impl<T> Copy for Complex<T> where T: Copy

impl<T> Clone for Complex<T> where T: Clone

impl<T> Hash for Complex<T> where T: Hash

impl<T> Debug for Complex<T> where T: Debug

impl<T> Default for Complex<T> where T: Default

impl<T> From<T> for Complex<T> where T: Clone + Num

impl<'a, T> From<&'a T> for Complex<T> where T: Clone + Num

impl<'a, 'b, T> Add<&'b Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Add<Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Add<&'a Complex<T>> for Complex<T> where T: Clone + Num

impl<T> Add<Complex<T>> for Complex<T> where T: Clone + Num

impl<'a, 'b, T> Sub<&'b Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Sub<Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Sub<&'a Complex<T>> for Complex<T> where T: Clone + Num

impl<T> Sub<Complex<T>> for Complex<T> where T: Clone + Num

impl<'a, 'b, T> Mul<&'b Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Mul<Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Mul<&'a Complex<T>> for Complex<T> where T: Clone + Num

impl<T> Mul<Complex<T>> for Complex<T> where T: Clone + Num

impl<'a, 'b, T> Div<&'b Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Div<Complex<T>> for &'a Complex<T> where T: Clone + Num

impl<'a, T> Div<&'a Complex<T>> for Complex<T> where T: Clone + Num

impl<T> Div<Complex<T>> for Complex<T> where T: Clone + Num

impl<T> Neg for Complex<T> where T: Neg<Output=T> + Clone + Num

impl<'a, T> Neg for &'a Complex<T> where T: Neg<Output=T> + Clone + Num

impl<'a, T> Add<&'a T> for Complex<T> where T: Clone + Num

impl<'a, T> Add<T> for &'a Complex<T> where T: Clone + Num

impl<'a, 'b, T> Add<&'a T> for &'b Complex<T> where T: Clone + Num

impl<'a, T> Sub<&'a T> for Complex<T> where T: Clone + Num

impl<'a, T> Sub<T> for &'a Complex<T> where T: Clone + Num

impl<'a, 'b, T> Sub<&'a T> for &'b Complex<T> where T: Clone + Num

impl<'a, T> Mul<&'a T> for Complex<T> where T: Clone + Num

impl<'a, T> Mul<T> for &'a Complex<T> where T: Clone + Num

impl<'a, 'b, T> Mul<&'a T> for &'b Complex<T> where T: Clone + Num

impl<'a, T> Div<&'a T> for Complex<T> where T: Clone + Num

impl<'a, T> Div<T> for &'a Complex<T> where T: Clone + Num

impl<'a, 'b, T> Div<&'a T> for &'b Complex<T> where T: Clone + Num

impl<T> Add<T> for Complex<T> where T: Clone + Num

impl<T> Sub<T> for Complex<T> where T: Clone + Num

impl<T> Mul<T> for Complex<T> where T: Clone + Num

impl<T> Div<T> for Complex<T> where T: Clone + Num

impl<T> Zero for Complex<T> where T: Clone + Num

Returns the additive identity element of Self, 0. Read more

Returns true if self is equal to the additive identity.

impl<T> One for Complex<T> where T: Clone + Num

Returns the multiplicative identity element of Self, 1. Read more

impl<T> Display for Complex<T> where T: Display + Num + PartialOrd<T> + Clone