# Optimal 5th Degree Polynomial which Approximates the Sine Function

Describes a 5th-degree polynomial that was found to approximate the sine function precisely up to 4 decimal digits. Useful for resource-constrained devices, games, or any applications where the precision of the least significant digits is not important.

Our goal is to aproximate the sine function `sin` between 0 and `pi/2`.

We found the best coefficients for a polynomial of degree 5 in the form `f(x) = c5 x^5 + c3 x^3 + c1 x` to be the following:

```c1 =  0.99977140751539240
c3 = -0.16582704279148017
c5 =  0.0075742477643552034```

According to Wolfram Alpha, the largest error in the domain between 0 and `pi/2` is of magnitude ~0.00016 at x~=1.5708, so this function should be good to use for up to 4 decimal digits.

Here's the query:

```maximize abs(0.0075742477643552034 x^5
+ -0.16582704279148017 x^3
+ 0.99977140751539240 x - sin(x))
with x between 0 and pi/2```

The coefficients were found by searching in `R^3` for the optimal vector of coefficients `(c5, c3, c1)` for the function `f(x) = c5 x^5 + c3 x^3 + c1 x` which minimize the RMSE (Root Mean Squared Error) between `f(x)` and `sin(x)`, assuming `x` in interval between 0 and `pi/2`.