Skip to content

Instantly share code, notes, and snippets.

@GM3D
Created April 9, 2017 03:13
Show Gist options
  • Save GM3D/5de2ba1dec67285d9ce01cca9f12a297 to your computer and use it in GitHub Desktop.
Save GM3D/5de2ba1dec67285d9ce01cca9f12a297 to your computer and use it in GitHub Desktop.
from sympy import sqrt
N = 15
a = [[]]*N
for n in range(N):
a[n] = [0]*(n+1)
if n == 0:
a[0][0] = 1
else:
for l in range(n + 1):
A = a[n-1][l+1] * sqrt(l+1) if l + 1 <= n - 1 else 0
B = a[n-1][l-1] * sqrt(l) if l - 1 >= 0 else 0
a[n][l] = A + B
for n in range(N):
print(a[n])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment