Skip to content

Instantly share code, notes, and snippets.

@Chubek
Created July 15, 2016 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chubek/d667cd331d03bb64ff4922ad7406850c to your computer and use it in GitHub Desktop.
Save Chubek/d667cd331d03bb64ff4922ad7406850c to your computer and use it in GitHub Desktop.
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