Created
July 28, 2020 15:14
-
-
Save CodeDrome/8084f1298b0f7bae0b94872720df8e45 to your computer and use it in GitHub Desktop.
estimatingpi.py part 3
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 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