TheAceHome

Untitled

Jun 10th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import numpy as np
  2. import math
  3. import matplotlib.pyplot as plt
  4. def summi(x,wo):
  5. s=1
  6. y=0
  7. i=1
  8. niz=[2]
  9. up=[5]
  10. while wo<abs(y-s) :
  11. if i%2==1:
  12. s+=np.prod(niz)*((2*i+3)*x**i)/(2*i)
  13. else:
  14. s-=np.prod(up)*((2*i+3)*x**i)/(2*i)
  15.  
  16. y=1/(np.sqrt((1+i)**5))
  17. niz.append(2*i)
  18. up.append(2*i+3)
  19. i+=1
  20. print(s,y-s)
  21. summi(0.5,0.0005)
  22.  
  23. x=[i for i in range(-10,10,1)]
  24. y=[1/(np.sqrt((1+i)**5)) for i in x]
  25. plt.plot(x,y)
  26. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment