Crates.io | ancomplex |
lib.rs | ancomplex |
version | 0.0.5 |
source | src |
created_at | 2024-08-11 21:54:15.060879 |
updated_at | 2024-08-24 21:15:37.519605 |
description | Package provides easy to use, begginer frendly and python like complex numbers |
homepage | |
repository | https://github.com/jsonmen/ancomplex |
max_upload_size | |
id | 1333663 |
size | 31,490 |
Package provides easy to use, begginer frendly and python like complex numbers
Create complex number
use ancomplex::*;
fn main() {
let c = complex(1, 2);
// \ \
// \ \
// \ Imaginary Part of complex number
// \
// \
// Real Part of complex number
}
Math operations
use ancomplex::*;
fn main() {
let c = complex(1, 2);
let k = complex(3, 4);
println!("Sum of two complex numbers: {}", c+k);
println!("Product of two complex numbers: {}", c*k);
println!("Sub of two complex numbers: {}", c-k);
println!("Div of two complex numbers: {}", c/k);
}
More complex functions
use ancomplex::*;
fn main() {
let c = complex(4, 5);
let k = complex(6, 7);
println!("Conjugate of complex number: {}", c.conj());
}
Fancy printing
use ancomplex::*;
fn main() {
let c = complex(4, 2);
println!("{}", c); // Output: 4 + 2i
}