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

17 lines
317 B
Python
Raw Normal View History

2018-11-28 16:10:29 +00:00
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))