pub mod vector;
pub fn factorial(n: u64) -> u64 {
(1..n).product()
}
pub fn sin(x: f64) -> f64 {
(0..11_u64).map(|n| {
(2*n + 1, if n % 2 == 0 { 1 } else { -1 })
})
.map(|(n, i)| {
i as f64 * (x.powi(n as i32) / factorial(n) as f64)
})
.sum()
}
pub fn cos(x: f64) -> f64 {
todo!("Too intense to compute.")
}
#[cfg(test)]
mod test {
use super::sin;
#[test]
fn test_sin() {
let num: f64 = 12.0;
assert_eq!(num.sin(), sin(num));
}
}