Processing math: 100%
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 1 year ago

Max Alekseyev gravatar image

Your generalized continued fraction can be reduced to the conventional one: [0;1,1,x,x,x2,x2,] 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) )