MTHS120 - plotting sequences
Plotting sequences
We plot the sequence an=cos(n)/na_n=\cos(n)/nan=cos(n)/n for n=1,2,…,100n=1,2,\dots,100n=1,2,…,100.
p = points([(n,cos(n)/n) for n in range(1,101)]) show(p)
We add the graphs of the functions given by f(x)=1/xf(x)=1/xf(x)=1/x and g(x)=−1/xg(x)=-1/xg(x)=−1/x to illustrate that from limx→∞1/x=0\lim_{x\to\infty}1/x=0limx→∞1/x=0 we can deduce limn→∞an=0\lim_{n\to\infty}a_n=0limn→∞an=0.
x = var('x') p += plot(1/x,x,1,100,color='red') + plot(-1/x,x,1,100,color='red') show(p)