Expand description
Generic complex numbers a + bi.
Complex<T> works over any type implementing num_traits::Num and
Copy. For floating-point components you also get norm, arg, and
to_polar.
§Examples
use numbers_rus::complex::Complex;
let a = Complex::new(1.0, 2.0);
let b = Complex::new(3.0, -4.0);
assert_eq!(a + b, Complex::new(4.0, -2.0));
assert_eq!(a * b, Complex::new(11.0, 2.0));
assert_eq!(Complex::new(0.0, 1.0) * Complex::new(0.0, 1.0), Complex::new(-1.0, 0.0));
assert!((a.norm() - (5.0f64).sqrt()).abs() < 1e-12);Structs§
- Complex
- A complex number
re + im·i.