Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import math
- import matplotlib.pyplot as plt
- def summi(x,wo):
- s=1
- y=0
- i=1
- niz=[2]
- up=[5]
- while wo<abs(y-s) :
- if i%2==1:
- s+=np.prod(niz)*((2*i+3)*x**i)/(2*i)
- else:
- s-=np.prod(up)*((2*i+3)*x**i)/(2*i)
- y=1/(np.sqrt((1+i)**5))
- niz.append(2*i)
- up.append(2*i+3)
- i+=1
- print(s,y-s)
- summi(0.5,0.0005)
- x=[i for i in range(-10,10,1)]
- y=[1/(np.sqrt((1+i)**5)) for i in x]
- plt.plot(x,y)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment