Skip to content

EComplex

spcan edited this page Mar 27, 2018 · 2 revisions

EComplex

What is it?

EComplex is a struct representation of a complex number in the exponential form

module * e ^ ( argument*i )

Methods

new

Method:

new() -> EComplex

Takes no arguments, returns a EComplex with value 0 * e ^ (0 * i)


new_from

Method:

new_from(&Complex) -> EComplex

Takes a reference to a Complex number, returns an equivalent EComplex

Can be considered to be a cast or transformation between types

It is a static method


real

Method:

real(&self) -> f64

Takes no arguments, returns the real part of the equivalent Complex number


imag

Method:

imag(&self) -> f64

Takes no arguments, returns the imaginary part of the equivalent Complex number


argd

Method:

argd(&self) -> f64

Takes no arguments, returns the argument (angle) of the number in degrees


sqrt

Method:

sqrt(&self) -> Result<Vec<EComplex>, &'static str>

Takes no arguments, returns the two square roots of the number


root

Method:

root(&self, n: usize) -> Result<Vec<EComplex>, &'static str>

Takes a usize, returns n possible nth roots of a number or a string error if it fails.


powi

Method:

powi(&self, p: isize) -> EComplex

Takes an isize, returns the number to the power of p


powf

Method:

powf(&self, p: f64) -> EComplex

Takes a 64 bit float, returns the number to the power of p

It uses a 64 bit float to reduce inaccuracies


conjugate

Method:

conjugate(&self) -> EComplex

Takes no arguments, returns the conjugate Complex number


abs

Method:

abs(&self) -> f64

Takes no arguments, returns the absolute value of the module of the number


exp

Method:

exp(&self) -> EComplex

Takes no arguments, returns the result of elevating e to the complex number


ln

Method:

ln(&self) -> EComplex

Takes no arguments, return the main logarithm of the number


log

Method:

log(&self, b: f64) -> EComplex

Takes a 64 bit float, returns the logarithm in base b of the number


inverse

Method:

inverse(&self) -> EComplex

Takes no arguments, returns one divided by the number (1/number)


cos

Method:

cos(&self) -> EComplex

Takes no arguments, returns the cosine of the number


sin

Method:

sin(&self) -> EComplex

Takes no arguments, returns the sine of the number


tan

Method:

tan(&self) -> Option<EComplex>

Takes no arguments, returns the tangent of the number or None if it tends to infinity


cosh

Method:

cosh(&self) -> EComplex

Takes no arguments, returns the hyperbolic cosine of the number


sinh

Method:

sinh(&self) -> EComplex

Takes no arguments, returns the hyperbolic sine of the number


tuple

Method:

tuple(&self) -> (f64, f64)

Takes no arguments, returns the module and argument of the number as a tuple (real, imag)


exp_tuple

Method:

c_tuple(&self) -> (f64, f64)

Takes no arguments, returns the real part and imaginary part of the equivalent Complex


Clone this wiki locally