1 | initial version |
Your generalized continued fraction can be reduced to the conventional one: $[0;1,1,x,x,x^2,x^2,\dots]$ Correspondingly, it can be computed for arbitrary $x$ via continuants, and then plotted as in the following code:
def g(x, n_terms):
X = sum( ([x^i,x^i] for i in range(n_terms)), [])
return continuant([0]+X) / continuant(X)
import functools
plot( functools.partial(g,n_terms=50), (1,50) )