Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Errors in rational approximations

37 views
unlisted
ubuntu2204
Kernel: SageMath 10.1
err = lambda x,n: round(x*n)/n - x
num=log(3/2)/log(2) dens = [5,..,24] points([(x, err(num,x)) for x in dens]) +\ sum([text(f"{x} ", (x, err(num,x)), horizontal_alignment='right') for x in dens])
Image in a Jupyter notebook
num=log(5/4)/log(2) dens = [5,..,24] points([(x, err(num,x)) for x in dens]) +\ sum([text(f"{x} ", (x, err(num,x)), horizontal_alignment='right') for x in dens])
Image in a Jupyter notebook

\newcommand{\err}{\operatorname{err}}

err = lambda x,n: round(x*n)/n - x fifth = log(3/2, 2) third = log(5/4, 2) dens = [2,..,55] r=0.04 dr=0.001 nn=e*pi show( points([(err(fifth,x), err(third,x)) for x in dens]) +\ sum([text(f"${x}$", (err(fifth,x)+dr*cos(2*pi*x/nn), err(third,x)+dr*sin(2*pi*x/nn))) for x in dens]), xmin=-r, xmax=r, ymin=-r, ymax=r, title='Error in $n$-TET', axes_labels=[r'$f(\log_2\frac{3}{2})$', r'$f(\log_2\frac{5}{4})$'], figsize=20)
Image in a Jupyter notebook