5个版本
新 0.0.5 | 2024年8月24日 |
---|---|
0.0.4 | 2024年8月22日 |
0.0.3 | 2024年8月21日 |
0.0.2 | 2024年8月12日 |
0.0.1 | 2024年8月11日 |
#399 in 数学
每月475次下载
22KB
561 行
ancomplex
该包提供易于使用、适合初学者且类似Python的复数。
示例
创建复数
use ancomplex::*;
fn main() {
let c = complex(1, 2);
// \ \
// \ \
// \ Imaginary Part of complex number
// \
// \
// Real Part of complex number
}
数学运算
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);
}
更复杂的函数
use ancomplex::*;
fn main() {
let c = complex(4, 5);
let k = complex(6, 7);
println!("Conjugate of complex number: {}", c.conj());
}
花哨的打印
use ancomplex::*;
fn main() {
let c = complex(4, 2);
println!("{}", c); // Output: 4 + 2i
}
路线图
- 提高三角函数的效率
- 添加从字符串解析的功能
依赖项
~155KB