Struct rgsl::types::complex::ComplexF64

source ·
#[repr(C)]
pub struct ComplexF64 { pub dat: [f64; 2], }

Fields§

§dat: [f64; 2]

Implementations§

source§

impl ComplexF64

source

pub fn rect(x: f64, y: f64) -> ComplexF64

This function uses the rectangular Cartesian components (x,y) to return the complex number z = x + i y.

source

pub fn polar(r: f64, theta: f64) -> ComplexF64

This function returns the complex number z = r \exp(i \theta) = r (\cos(\theta) + i \sin(\theta)) from the polar representation (r,theta).

source

pub fn arg(&self) -> f64

This function returns the argument of the complex number z, \arg(z), where -\pi < \arg(z) <= \pi.

source

pub fn abs(&self) -> f64

This function returns the magnitude of the complex number z, |z|.

source

pub fn abs2(&self) -> f64

This function returns the squared magnitude of the complex number z, |z|^2.

source

pub fn logabs(&self) -> f64

This function returns the natural logarithm of the magnitude of the complex number z, \log|z|.

It allows an accurate evaluation of \log|z| when |z| is close to one.

The direct evaluation of log(gsl_complex_abs(z)) would lead to a loss of precision in this case.

source

pub fn add(&self, other: &ComplexF64) -> ComplexF64

This function returns the sum of the complex numbers a and b, z=a+b.

source

pub fn sub(&self, other: &ComplexF64) -> ComplexF64

This function returns the difference of the complex numbers a and b, z=a-b.

source

pub fn mul(&self, other: &ComplexF64) -> ComplexF64

This function returns the product of the complex numbers a and b, z=ab.

source

pub fn div(&self, other: &ComplexF64) -> ComplexF64

This function returns the quotient of the complex numbers a and b, z=a/b.

source

pub fn add_real(&self, x: f64) -> ComplexF64

This function returns the sum of the complex number a and the real number x, z=a+x.

source

pub fn sub_real(&self, x: f64) -> ComplexF64

This function returns the difference of the complex number a and the real number x, z=a-x.

source

pub fn mul_real(&self, x: f64) -> ComplexF64

This function returns the product of the complex number a and the real number x, z=ax.

source

pub fn div_real(&self, x: f64) -> ComplexF64

This function returns the quotient of the complex number a and the real number x, z=a/x.

source

pub fn add_imag(&self, x: f64) -> ComplexF64

This function returns the sum of the complex number a and the imaginary number iy, z=a+iy.

source

pub fn sub_imag(&self, x: f64) -> ComplexF64

This function returns the difference of the complex number a and the imaginary number iy, z=a-iy.

source

pub fn mul_imag(&self, x: f64) -> ComplexF64

This function returns the product of the complex number a and the imaginary number iy, z=a*(iy).

source

pub fn div_imag(&self, x: f64) -> ComplexF64

This function returns the quotient of the complex number a and the imaginary number iy, z=a/(iy).

source

pub fn conjugate(&self) -> ComplexF64

This function returns the complex conjugate of the complex number z, z^* = x - i y.

source

pub fn inverse(&self) -> ComplexF64

This function returns the inverse, or reciprocal, of the complex number z, 1/z = (x - i y)/ (x^2 + y^2).

source

pub fn negative(&self) -> ComplexF64

This function returns the negative of the complex number z, -z = (-x) + i(-y).

source

pub fn sqrt(&self) -> ComplexF64

This function returns the square root of the complex number z, \sqrt z.

The branch cut is the negative real axis. The result always lies in the right half of the omplex plane.

source

pub fn sqrt_real(x: f64) -> ComplexF64

This function returns the complex square root of the real number x, where x may be negative.

source

pub fn pow(&self, other: &ComplexF64) -> ComplexF64

The function returns the complex number z raised to the complex power a, z^a. This is computed as \exp(\log(z)*a) using complex logarithms and complex exponentials.

source

pub fn pow_real(&self, x: f64) -> ComplexF64

This function returns the complex number z raised to the real power x, z^x.

source

pub fn exp(&self) -> ComplexF64

This function returns the complex exponential of the complex number z, \exp(z).

source

pub fn log(&self) -> ComplexF64

This function returns the complex natural logarithm (base e) of the complex number z, \log(z).

The branch cut is the negative real axis.

source

pub fn log10(&self) -> ComplexF64

This function returns the complex base-10 logarithm of the complex number z, \log_10 (z).

source

pub fn log_b(&self, other: &ComplexF64) -> ComplexF64

This function returns the complex base-b logarithm of the complex number z, \log_b(z). This quantity is computed as the ratio \log(z)/\log(b).

source

pub fn sin(&self) -> ComplexF64

This function returns the complex sine of the complex number z, \sin(z) = (\exp(iz) - \exp(-iz))/(2i).

source

pub fn cos(&self) -> ComplexF64

This function returns the complex cosine of the complex number z, \cos(z) = (\exp(iz) + \exp(-iz))/2.

source

pub fn tan(&self) -> ComplexF64

This function returns the complex tangent of the complex number z, \tan(z) = \sin(z)/\cos(z).

source

pub fn sec(&self) -> ComplexF64

This function returns the complex secant of the complex number z, \sec(z) = 1/\cos(z).

source

pub fn csc(&self) -> ComplexF64

This function returns the complex cosecant of the complex number z, \csc(z) = 1/\sin(z).

source

pub fn cot(&self) -> ComplexF64

This function returns the complex cotangent of the complex number z, \cot(z) = 1/\tan(z).

source

pub fn arcsin(&self) -> ComplexF64

This function returns the complex arcsine of the complex number z, \arcsin(z). The branch cuts are on the real axis, less than -1 and greater than 1.

source

pub fn arcsin_real(z: f64) -> ComplexF64

This function returns the complex arcsine of the real number z, \arcsin(z).

  • For z between -1 and 1, the function returns a real value in the range [-\pi/2,\pi/2].
  • For z less than -1 the result has a real part of -\pi/2 and a positive imaginary part.
  • For z greater than 1 the result has a real part of \pi/2 and a negative imaginary part.
source

pub fn arccos(&self) -> ComplexF64

This function returns the complex arccosine of the complex number z, \arccos(z). The branch cuts are on the real axis, less than -1 and greater than 1.

source

pub fn arccos_real(z: f64) -> ComplexF64

This function returns the complex arccosine of the real number z, \arccos(z).

  • For z between -1 and 1, the function returns a real value in the range [0,\pi].
  • For z less than -1 the result has a real part of \pi and a negative imaginary part.
  • For z greater than 1 the result is purely imaginary and positive.
source

pub fn arctan(&self) -> ComplexF64

This function returns the complex arctangent of the complex number z, \arctan(z). The branch cuts are on the imaginary axis, below -i and above i.

source

pub fn arcsec(&self) -> ComplexF64

This function returns the complex arcsecant of the complex number z, \arcsec(z) = \arccos(1/z).

source

pub fn arcsec_real(z: f64) -> ComplexF64

This function returns the complex arcsecant of the real number z, \arcsec(z) = \arccos(1/z).

source

pub fn arccsc(&self) -> ComplexF64

This function returns the complex arccosecant of the complex number z, \arccsc(z) = \arcsin(1/z).

source

pub fn arccsc_real(z: f64) -> ComplexF64

This function returns the complex arccosecant of the real number z, \arccsc(z) = \arcsin(1/z).

source

pub fn arccot(&self) -> ComplexF64

This function returns the complex arccotangent of the complex number z, \arccot(z) = \arctan(1/z).

source

pub fn sinh(&self) -> ComplexF64

This function returns the complex hyperbolic sine of the complex number z, \sinh(z) = (\exp(z) - \exp(-z))/2.

source

pub fn cosh(&self) -> ComplexF64

This function returns the complex hyperbolic cosine of the complex number z, \cosh(z) = (\exp(z) + \exp(-z))/2.

source

pub fn tanh(&self) -> ComplexF64

This function returns the complex hyperbolic tangent of the complex number z, \tanh(z) = \sinh(z)/\cosh(z).

source

pub fn sech(&self) -> ComplexF64

This function returns the complex hyperbolic secant of the complex number z, \sech(z) = 1/\cosh(z).

source

pub fn csch(&self) -> ComplexF64

This function returns the complex hyperbolic cosecant of the complex number z, \csch(z) = 1/\sinh(z).

source

pub fn coth(&self) -> ComplexF64

This function returns the complex hyperbolic cotangent of the complex number z, \coth(z) = 1/\tanh(z).

source

pub fn arcsinh(&self) -> ComplexF64

This function returns the complex hyperbolic arcsine of the complex number z, \arcsinh(z). The branch cuts are on the imaginary axis, below -i and above i.

source

pub fn arccosh(&self) -> ComplexF64

This function returns the complex hyperbolic arccosine of the complex number z, \arccosh(z). The branch cut is on the real axis, less than 1. Note that in this case we use the negative square root in formula 4.6.21 of Abramowitz & Stegun giving \arccosh(z)=\log(z-\sqrt{z^2-1}).

source

pub fn arccosh_real(z: f64) -> ComplexF64

This function returns the complex hyperbolic arccosine of the real number z, \arccosh(z).

source

pub fn arctanh(&self) -> ComplexF64

This function returns the complex hyperbolic arctangent of the complex number z, \arctanh(z).

The branch cuts are on the real axis, less than -1 and greater than 1.

source

pub fn arctanh_real(z: f64) -> ComplexF64

This function returns the complex hyperbolic arctangent of the real number z, \arctanh(z).

source

pub fn arcsech(&self) -> ComplexF64

This function returns the complex hyperbolic arcsecant of the complex number z, \arcsech(z) = \arccosh(1/z).

source

pub fn arccsch(&self) -> ComplexF64

This function returns the complex hyperbolic arccosecant of the complex number z, \arccsch(z) = \arcsin(1/z).

source

pub fn arccoth(&self) -> ComplexF64

This function returns the complex hyperbolic arccotangent of the complex number z, \arccoth(z) = \arctanh(1/z).

source

pub fn real(&self) -> f64

source

pub fn imaginary(&self) -> f64

Trait Implementations§

source§

impl Clone for ComplexF64

source§

fn clone(&self) -> ComplexF64

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ComplexF64

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ComplexF64

source§

fn default() -> ComplexF64

Returns the “default value” for a type. Read more
source§

impl PartialEq for ComplexF64

source§

fn eq(&self, other: &ComplexF64) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ComplexF64

source§

impl StructuralPartialEq for ComplexF64

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.