#complex-numbers #complex #num-complex

ancomplex

Package provides easy to use, begginer frendly and python like complex numbers

5 releases

0.0.5 Aug 24, 2024
0.0.4 Aug 22, 2024
0.0.3 Aug 21, 2024
0.0.2 Aug 12, 2024
0.0.1 Aug 11, 2024

#570 in Math

MIT/Apache

32KB
922 lines

ancomplex

Package provides easy to use, begginer frendly and python like complex numbers

Examples

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
}

Roadmap

  • Make trigonometric function more efficent
  • Add parsing from strings

Dependencies

~150KB