pub struct Complex {
pub re: f64,
pub im: f64,
}Expand description
Complex number re + im·i.
Fields§
§re: f64§im: f64Implementations§
Source§impl Complex
impl Complex
pub fn new(re: f64, im: f64) -> Complex
pub fn real(r: f64) -> Complex
pub fn i() -> Complex
pub fn conjugate(&self) -> Complex
pub fn norm_sq(&self) -> f64
pub fn norm(&self) -> f64
pub fn is_zero(&self) -> bool
Sourcepub fn sqrt(&self) -> Complex
pub fn sqrt(&self) -> Complex
Principal square root.
use mathverse_complex::Complex;
let s = Complex::new(-4.0, 0.0).sqrt();
assert!((s.im - 2.0).abs() < 1e-12 && s.re.abs() < 1e-12);Sourcepub fn exp(&self) -> Complex
pub fn exp(&self) -> Complex
e^self.
use mathverse_complex::Complex;
let e = Complex::new(0.0, core::f64::consts::PI).exp();
assert!((e.re + 1.0).abs() < 1e-12 && e.im.abs() < 1e-12);pub fn sin(&self) -> Complex
pub fn cos(&self) -> Complex
pub fn tan(&self) -> Complex
Sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Returns true if either component is infinite.
Trait Implementations§
impl Copy for Complex
impl StructuralPartialEq for Complex
Auto Trait Implementations§
impl Freeze for Complex
impl RefUnwindSafe for Complex
impl Send for Complex
impl Sync for Complex
impl Unpin for Complex
impl UnsafeUnpin for Complex
impl UnwindSafe for Complex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more