Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # https://en.wikipedia.org/wiki/Basel_problem
- # Leonhard Euler solved it in 1734
- # and published it in 1735 St Peterburg's Adacemy of Sciences
- # Basel problem is Riemann's zeta-function at value s = 2
- # https://en.wikipedia.org/wiki/Riemann_zeta_function
- # Juhani Kaukoranta 23.6.2018
- import math
- import numpy as np
- def Basel():
- '''reciprocals, 1/n'''
- a = np.reciprocal(np.arange(1,500000000,1.0))
- '''sum of 1/(n*n)'''
- summa = np.sum(np.multiply(a,a))
- return(summa)
- print(" Basel problem sum = ",Basel())
- print("Pii^2 / 6 = ",math.pi*math.pi/6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement