Question: add the complete code (python) Write a function estimatePi( to estimate and return the value of pi based on the formula found by an Indian
add the complete code (python)
Write a function estimatePi( to estimate and return the value of pi based on the formula found by an Indian Mathematician Srinivasa Ramanujan. It should use a while loop to compute the terms of the summation until the last item is smaller than 1e -15. The formula for calculating distance is given below: 7T k=0 1 22 * (4k)!(1103 + 26390k) jo 9801 (k!)43964k where k! is the factorial of k. Examples >>> estimatePi() 3.14159265359 10 pt JUAWNA 1 def estimatePi(): 2. import math 3 def factorial(n): if n == 0: return 1 else: return n * factorial(n-1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
