1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! # Distributions
//! This module contains functions related to gamma and beta distributions in Rust.
//! The functions include finding the gamma function, beta function, permutation and combination in Rust.
//! # Examples
//! ```
//! use rusty_math::distributions::{permutation, combination, gamma, beta};
//! let result = permutation(5, 2);
//! ```
use crate::;
/// Function to find the number of ways to choose and arrange r items from n items
/// # Paramaters:
/// n: `usize` - The total number of items
/// r: `usize` - The number of items to be arranged
/// # Returns:
/// `usize` - The number of ways to choose and arrange r items from n items
/// # Examples
/// ```
/// use rusty_math::distributions::permutation;
/// let result = permutation(5, 2);
/// ```
/// Function to find the number of ways to choose r items from n items
/// # Paramaters:
/// n: `usize` - The total number of items
/// r: `usize` - The number of items to be chosen
/// # Returns:
/// `usize` - The number of ways to choose r items from n items
/// # Examples
/// ```
/// use rusty_math::distributions::combination;
/// let result = combination(5, 2);
/// ```
/// Function to find the gamma function of a number
/// # Paramaters:
/// n: `f64` - The number whose gamma function is to be found
/// # Returns:
/// `f64` - The gamma function of the given number
/// # Examples
/// ```
/// use rusty_math::distributions::gamma;
/// let result = gamma(5.8);
/// ```
/// Function to find the beta function of two numbers
/// # Paramaters:
/// x: `f64` - The first number
/// y: `f64` - The second number
/// # Returns:
/// `f64` - The beta function of the two numbers
/// # Examples
/// ```
/// use rusty_math::distributions::beta;
/// let result = beta(5.5, 3.52);
/// ```