Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import pi as P
- # 1 способ
- ans=1
- for i in range(2,10000000,2):
- ans*=(i/(i-1))
- ans*=(i/(i+1))
- ans*=2
- print(ans)
- print(P-ans)
- # 2 способ
- ans=0
- for i in range(1,10000000,4):
- ans+=(1/i)
- ans-=(1/(i+2))
- ans*=4
- print(ans)
- print(P-ans)
- # 3 способ
- ans=0
- for i in range(1,10000000):
- ans+=(1/(i**2))
- ans*=6
- ans**=(1/2)
- print(ans)
- print(P-ans)
- # 4 способ
- ans=1
- for i in range(1,1000):
- ans1=2**(1/2)
- for j in range(i-1):
- ans1+=2
- ans1**=(1/2)
- ans*=(ans1/2)
- ans=2/ans
- print(ans)
- print(P-ans)
- # Формула Виета является самой быстрой и точной
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement