SharedMTHS120.ipynbOpen in CoCalc
MTHS120 - plotting sequences

Plotting sequences

We plot the sequence $a_n=\cos(n)/n$ for $n=1,2,\dots,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/x$ and $g(x)=-1/x$ to illustrate that from $\lim_{x\to\infty}1/x=0$ we can deduce $\lim_{n\to\infty}a_n=0$.

x = var('x')
p += plot(1/x,x,1,100,color='red') + plot(-1/x,x,1,100,color='red')
show(p)