Skip to content

Instantly share code, notes, and snippets.

@Radcliffe
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save Radcliffe/b2ab0f5c7a0fd66108c8 to your computer and use it in GitHub Desktop.

Select an option

Save Radcliffe/b2ab0f5c7a0fd66108c8 to your computer and use it in GitHub Desktop.
Inverse factorial
from math import log, sqrt, pi, e
from scipy.special import lambertw
fomm numpy import real
# http://mathforum.org/kb/message.jspa?messageID=342551&tstart=0
def invfactorial(n):
""" Approximate inverse factorial"""
L = log((x + .036534) / sqrt(2*pi))
return real(L/W(L/e) - .5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment