수열의 수렴성

수열의 수렴성을 그래프로 나타내어 봄.

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

x = np.arange(1, 50, 1)
x1 = np.arange(1, 20, 1)

x2= np.arange(20, 50, 1)
y = 1/x
y1=1/x1
y2=1/x2
y3=1/x**2
Z=x*0
Z1=x*0-0.05



z=np.linspace(0,0,49)

name_list=(0,10,20,30,40,50)
pos_list=(0,10,20,30,40,50)
ax=plt.axes()
plt.ylim(-0.1,1.1)
plt.xlim(0,50)

# plt.scatter(x,y,c='blue',label=r"$\frac{1}{n}$")
plt.scatter(x1,y1,c='blue')
plt.scatter(x2,y2,c='red')
plt.scatter(x,y3,c='black')



plt.plot(x,Z1,c="gray",lw=1.5)
plt.plot(x,-Z1,c="gray",lw=1.5)

plt.grid(True,lw=1,ls="--",c='.75')
plt.legend(shadow=True, fontsize=30, fancybox=True)#,loc="lower right")

plt.show()

Leave a Comment