Created
March 9, 2013 17:10
-
-
Save zmaril/5124868 to your computer and use it in GitHub Desktop.
Approximation function for cosine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cos(x): | |
i = 0 | |
coefficents = [1,2,3,4,5] | |
y = 0; | |
while(i < coefficents.length){ | |
y = y + (coefficents[i]*x^i)/factorial(i) | |
} | |
return y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment