#list #trigonometry #prime-factors

no-std rust_math

Math library written in Rust

9 releases

0.3.7 Sep 17, 2022
0.3.6 Aug 13, 2022
0.2.7 Sep 17, 2022
0.2.6 Aug 13, 2022
0.1.2 Jun 12, 2022

#532 in Math

Download history 7/week @ 2024-02-19 21/week @ 2024-02-26 115/week @ 2024-03-04 16/week @ 2024-03-11 22/week @ 2024-03-18 7/week @ 2024-03-25 53/week @ 2024-04-01 6/week @ 2024-04-08 8/week @ 2024-04-15

76 downloads per month

MIT license

16KB
306 lines

rust_math

Math library written in Rust. Functions for integer lists, for numbers, and trigonometry functions.

Functions For lists

rust_math::list::bubble_sort(list: &mut [usize]) { ... } :

Sorts the list with algorithm bubble sort

rust_math::list::reverse_bsort(list: &mut [usize]) { ... } :

Bubble sort but reversed

rust_math::list::med(list: &[usize]) -> i32 { ... } :

This function returns median of the list

rust_math::list::safe_med(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.

rust_math::list::std_devitation(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.

rust_math::list::check_sorted(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)

rust_math::num::is_prime(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

rust_math::num::prime_factor(num: i32) -> Vec { ... } :

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

rust_math::trigonometry::find_quadrant(angle: f32) -> i32 { ... } :

Finds quadrant of angle in degrees

Will be added:

1 - Problem solvers, at least for find x at first. Time unknown.

Thanks for using this project ❤️

No runtime deps