Ask Your Question

Revision history [back]

An infinite continued fraction of $x^n$

I coded in SageMath to compute the 50th convergent of $f(x)$ and plot for integers $x=1,\dots,50$:

def f(x, n_terms):
    result = []
    for i in range(n_terms):
        result.extend([x**i, x**i])
    return continued_fraction([0] + result).n()

list_plot(([f(x,50) for x in range(1,50)]), title='$f(x)=\\dfrac{x}{x+\\dfrac{x^2}{x^2+\\dfrac{x^3}{x^3+\\ddots}}}$')

My question is to make a continuous plot of $f(x)$. I have difficulty in that continued_fraction only support integer values of $x$.