-
Notifications
You must be signed in to change notification settings - Fork 0
Complex
Complex is a struct representation of a complex number in the usual form
(a + b*i)
Method:
new() -> ComplexTakes no arguments, returns a Complex with value (0 + 0*i)
Method:
new_from(&EComplex) -> ComplexTakes a reference to a EComplex number, returns a Complex number of the same value
Can be considered to be a cast or transformation between types
It is a static method
Method:
module(&self) -> f64Takes no arguments, returns the module of the equivalent EComplex
Method:
arg(&self) -> f64Takes no arguments, returns the argument (angle) of the equivalent EComplex in radians
Method:
argd(&self) -> f64Takes no arguments, returns the argument (angle) of the equivalent EComplex in degrees
Method:
sqrt(&self) -> Result<Vec<Complex>, &'static str>Takes no arguments, returns the two square roots of the number
Method:
root(&self, n: usize) -> Result<Vec<Complex>, &'static str>Takes a usize, returns n possible nth roots of a number or a string error if it fails.
Method:
powi(&self, p: isize) -> ComplexTakes an isize, returns the number to the power of p
Method:
powf(&self, p: f64) -> ComplexTakes a 64 bit float, returns the number to the power of p
It uses a 64 bit float to reduce inaccuracies
Method:
conjugate(&self) -> ComplexTakes no arguments, returns the conjugate Complex number
Method:
abs(&self) -> f64Takes no arguments, returns the absolute value of the module of the number
Method:
exp(&self) -> ComplexTakes no arguments, returns the result of elevating e to the complex number
Method:
ln(&self) -> ComplexTakes no arguments, return the main logarithm of the number
Method:
log(&self, b: f64) -> ComplexTakes a 64 bit float, returns the logarithm in base b of the number
Method:
inverse(&self) -> ComplexTakes no arguments, returns one divided by the number (1/number)
Method:
cos(&self) -> ComplexTakes no arguments, returns the cosine of the number
Method:
sin(&self) -> ComplexTakes no arguments, returns the sine of the number
Method:
tan(&self) -> Option<Complex>Takes no arguments, returns the tangent of the number or None if it tends to infinity
Method:
cosh(&self) -> ComplexTakes no arguments, returns the hyperbolic cosine of the number
Method:
sinh(&self) -> ComplexTakes no arguments, returns the hyperbolic sine of the number
Method:
tuple(&self) -> (f64, f64)Takes no arguments, returns the real and imaginary part of the number as a tuple (real, imag)
Method:
exp_tuple(&self) -> (f64, f64)Takes no arguments, returns the module and argument of the equivalent EComplex