from functools import reduce
import math
import numpy
####################导入时间模块
import time
###############计算当前时间
time1=time.time()
math.sqrt(2 - math.sqrt((4 - numpy.square(1))))
i = 1
j = 0
n = 20
pi = []
while j < n:
i = (numpy.sqrt(2 - numpy.sqrt(4 - numpy.square(i))))
j += 1
pi = ((float(i) * 6 * (2 ** (j)))/2)
print (pi)
time2=time.time()
import math
import numpy
####################导入时间模块
import time
###############计算当前时间
time1=time.time()
math.sqrt(2 - math.sqrt((4 - numpy.square(1))))
i = 1
j = 0
n = 20
pi = []
while j < n:
i = (numpy.sqrt(2 - numpy.sqrt(4 - numpy.square(i))))
j += 1
pi = ((float(i) * 6 * (2 ** (j)))/2)
print (pi)
time2=time.time()
print ('总共耗时:' + str(time2 - time1) + 's')
n 大点就:int too large to convert to float,只能为20左右~