Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- 3*pi + SUM[n=0; n=INF]{(-1)^(n+1)*6*(x/2)^(2*n+1) / (2*n+1)}
- """
- from math import *
- x = float(input('x = '))
- eps = float(input('eps = '))
- ### Sn = 6*(x/2)
- Sn = 0 ###
- S = 3*pi
- ### n= 1
- n=0 ###
- while True:
- ### Sn = pow(-1, (n+1))*pow(Sn, (2*n+1)) / (2*n+1)
- Sn = pow(-1, (n+1))*6*pow((x/2), (2*n + 1)) / (2*n+1)###
- S += Sn
- n += 1
- if fabs(Sn) < eps:
- break
- ### zn = 6*atan(x/2)
- zn = 6*(pi/2-atan(x/2)) ###
- print('{0} {1:.4f}'.format('6*arcctg(x/2)= ', zn))
- print('{0} {1:.4f}'.format('S = ', S))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement