Skip to content

Instantly share code, notes, and snippets.

@CodeDrome
Created July 28, 2020 15:14
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 CodeDrome/8084f1298b0f7bae0b94872720df8e45 to your computer and use it in GitHub Desktop.
Save CodeDrome/8084f1298b0f7bae0b94872720df8e45 to your computer and use it in GitHub Desktop.
estimatingpi.py part 3
def francois_viete():
"""
Infinite series discovered by French mathematician Francois Viete in 1593
"""
print("Francois Viete\n==============")
iterations = 28
numerator = 0.0
pi = 1.0
for i in range(1, iterations + 1):
numerator = math.sqrt(2.0 + numerator)
pi*= (numerator / 2.0)
pi = (1.0 / pi) * 2.0
print_as_text(pi)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment