Created
July 15, 2016 10:52
-
-
Save Chubek/d667cd331d03bb64ff4922ad7406850c to your computer and use it in GitHub Desktop.
This file contains 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 factorial(n): | |
factorial = 1 | |
for i in range(1, n+1): | |
factorial *= i | |
return factorial | |
def sine(d): | |
serial = 0 | |
for i in (0, d): | |
serial += ((-1)**i / (factorial((2 * i) + 1))) * d ** ((2*i) + 1) | |
return serial | |
sine = sine(45) | |
cosine = 1 - sine | |
tangent = sine / cosine | |
cotangent = cosine / sine | |
print (sine, cosine, tangent, cotangent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment