scientific-programming-exer.../ex_21.py

17 lines
317 B
Python

from scipy.special import zeta
class ZetaApprox(object):
def __init__(self, N):
self._N = N
def __call__(self, s):
result = 1
for n in range(1, self._N + 1):
result += 1 / n**s
return result
if( __name__ == "__main__"):
zeta_approx= ZetaApprox(10000000)
print(zeta_approx(1.15))
print(zeta(1.15))