Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import math
  2. import numpy as np
  3. from matplotlib import mlab
  4. import pylab
  5. factorial = 1.0
  6. sign = 1.0
  7. x = 0.0
  8. result = 0.0
  9. x = math.pi/2
  10. n = 1
  11. n = input ()
  12. slave = 1.0
  13. fact = 1.0
  14. term = x
  15. for i in range (1,n):
  16. result = result + term
  17. sign = sign * (-1)
  18. slave = slave + 2.0
  19. fact = fact * (slave - 1) * slave
  20. term = term * x * x * sign / (1.0*fact)
  21. print result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement