Ask Your Question

Revision history [back]

As far as I understand this is what you want

def T(n):
    x = polygen(ZZ)     # or alternatively x = var("x")
    a=1
    b=x
    if n==0:
        return a
    if n==1:
        return b
    else:
        for i in [2..n]:
            b=2*x*b-a
            a=(a+b)/(2*x)
    return b