I have the following recurrence relation, where ak are just indeterminates:
Z0:=1,Zn:=1n∑nk=1akZn−k∀n>0
I tried the following, but it doesn't work:
def Z(n):
if n == 0:
return 1
else:
a = var(','.join('a%s'%(i+1) for i in range(n)))
return 1/n*sum(a[k-1]*Z(n-k),k,1,n)
What am I doing wrong?