sin

Function sin 

Source
pub fn sin<T>(x: T) -> T
Expand description

Calculate sin(x) using a Taylor approximation of sin(x).

Sin is calculated using the following polynomial:

sin(x) = x -( x^3/6 )+( x^5/120 )-( x^7/5040 )+( x^9/362880 )

§Argument

  • x - The value to apply the operation to.

x must be wrapped to the -π=<x<π range.

§Example

use mixed_num::trigonometry::*;
 
let mut x:f32 = 0.0;
let mut y = sin(x);
assert_eq!{ y, 0.0 };
 
x = 3.1415/2.0;
y = sin(x);
assert_eq!{ y, 1.0000035 };
 
x = 3.1415;
y = sin(x);
assert_eq!{ y, 9.274483e-5 };