Advertisement
Dzham

Untitled

Mar 11th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. def low_sum(n):
  2. result = 0
  3. for i in range(1, n + 1):
  4. if math.pi * i / n - math.pi / 2 == 0:
  5. result += 1
  6. else:
  7. result += math.sin(math.pi * i / n - math.pi / 2)/ (math.pi * i / n - math.pi / 2)
  8. return result
  9.  
  10. def up_sum(n):
  11. result = 0
  12. for i in range(1, n + 1):
  13. if math.pi * (i - 1) / n - math.pi / 2 == 0:
  14. result += 1
  15. else:
  16. result += math.sin(math.pi * (i - 1) / n - math.pi / 2)/ (math.pi * (i - 1) / n - math.pi / 2)
  17. return result
  18.  
  19. print(low_sum(10000))
  20. print(up_sum(10000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement