Skip to content

Instantly share code, notes, and snippets.

@timcdlucas
Created July 8, 2014 09:02
Show Gist options
  • Save timcdlucas/b086cd2cc3a240f1c477 to your computer and use it in GitHub Desktop.
Save timcdlucas/b086cd2cc3a240f1c477 to your computer and use it in GitHub Desktop.
from sympy import *
from sympy import init_printing ;
init_printing()
n, k = symbols('n k')
s1 = summation(k, (k, 0, n)) # works fine
s2 = summation((factorial(n)*n**k)/factorial(k)*factorial(n-k), (k, 0, n)) # works but gives crazy results
s3 = summation((factorial(n)*n**k)/(factorial(k)*factorial(n-k)), (k, 0, n)) # python hangs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment