rust_math
Math library written in Rust.
Functions for integer lists, for numbers, and trigonometry functions.
Adding to your project
Just add rust_math = "0.3.6"
to Cargo.toml file.
Functions For lists
rustmath::list::bubblesort(list: &mut [usize]) { ... } :
Sorts the list with algorithm bubble sort
rustmath::list::reversebsort(list: &mut [usize]) { ... } :
Bubble sort but reversed
rust_math::list::med(list: &[usize]) -> i32 { ... } :
This function returns median of the list
rustmath::list::safemed(list: &[usize]) -> i32 { ... } :
If list is sorted returns median of list, else -1.
rust_math::list::avg(list: &[usize]) -> f32 { ... } :
This function returns average of the list
rust_math::list::mode(list: &[usize]) -> i32 { ... } :
This funtion returns mode of list.
rustmath::list::stddevitation(list: &[usize]) -> f32 { ... } :
This function returns the standard deviation of the list.
rust_math::list::highest(list: &[usize]) -> i32 { ... } :
This function returns the highest number in the list.
rust_math::list::lowest(list: &[usize]) -> i32 { ... } :
This function returns the lowest number in the list.
rustmath::list::checksorted(list: &[usize]) -> bool { ... } :
Returns true if list is sorted, else false.
For numbers
rust_math::num::sqrt(num: f32) -> f32 { ... } :
Returns square root of number
rust_math::num::abs(num: f32) -> f32 { ... } :
Returns absolute value of number
rust_math::num::factorial(num: i128) -> i128 { ... } :
Returns factorial of number. (i128 is due to overflow)
rustmath::num::isprime(number: i32) -> bool { ... } :
Returns true if prime. Else false.
rust_math::num::gcd(a: i32, b: i32) -> i32 { ... } :
Finds greatest common divisor of two numbers
rust_math::num::lcm(a: i32, b: i32) -> i32 { ... } :
Finds least common of 2 numbers
rustmath::num::primefactor(num: i128) -> Vec< i128 > { ... } :
Find prime factors of given number
Trigonometry
rust_math::trigonometry::sin(ang: f32) -> f32 { ... } :
Finds sine of angle in degrees
rust_math::trigonometry::cos(ang: f32) -> f32 { ... }:
Finds cosine of angle in degrees
rust_math::trigonometry::tan(ang: f32) -> f32 { ... } :
Finds tangent of angle in degrees
rust_math::trigonometry::cotan(ang: f32) -> f32 { ... } :
Finds cotangent of angle in degrees
rust_math::trigonometry::sec(ang: f32) -> f32 { ... } :
Finds secant of angle in degrees
rust_math::trigonometry::cosec(ang: f32) -> f32 { ... } :
Finds cosecant of angle in degrees
rust_math::trigonometry::arcsin(ang: f32) -> f32 { ... } :
Finds arcsine of number
rust_math::trigonometry::arctan(ang: f32) -> f32 { ... } :
Finds arctangent of number
rust_math::trigonometry::arccos(ang: f32) -> f32 { ... } :
Finds arccosine of number
rust_math::trigonometry::deg2rad(ang: f32) -> f32 { ... } :
Converts degrees to radians
rust_math::trigonometry::rad2deg(ang: f32) -> f32 { ... } :
Converts radians to degrees
rustmath::trigonometry::findquadrant(angle: f32) -> i32 { ... } :
Finds quadrant of angle in degrees