k = the positive zero of the digamma function, approximately 1.461632
c = Sqrt(2*pi)/e - Γ(k), approximately 0.036534
L(x) = ln((x+c)/Sqrt(2*pi))
W(x) = Lambert W function
ApproxInvGamma(x) = L(x) / W(L(x) / e) + 1/2
David Cantrell gives a good approximation of Γ-1(n) on this page:
k = the positive zero of the digamma function, approximately 1.461632
c = Sqrt(2*pi)/e - Γ(k), approximately 0.036534
L(x) = ln((x+c)/Sqrt(2*pi))
W(x) = Lambert W function
ApproxInvGamma(x) = L(x) / W(L(x) / e) + 1/2
i = 2
n = someNum
while (n != 1):
n /= i
i += 1
return (i==1 ? i : None)
The factorial for real numbers has no inverse. You say that "each function must have an inverse". That is incorrect. Consider the constant function f(x)=0. What is f^-1(42)? For a function to be inverse it must be both an injection and a surjection.
发布评论
评论(3)
使用wolframalpha.com,您可以询问
正如评论中提到的,Gamma 没有唯一的逆。即使您求解传统阶乘时也是如此,例如,
会产生多个答案,其中一个是 3。
除了在 WolframAlpha 中使用 Gamma[] 之外,您还可以使用 Factorial[]:
Using wolframalpha.com, you can ask for
As mentioned in the comments, Gamma does not have a unique inverse. True even when you are solving for a conventional factorial, e.g.
yields several answers, of which one is 3.
Instead of using Gamma[] in WolframAlpha, you can also use Factorial[]:
David Cantrell 在 此页面:
David Cantrell gives a good approximation of Γ-1(n) on this page:
对于整数,你可以这样做:
实数的阶乘没有倒数。你说“每个函数都必须有一个反函数”。这是不正确的。考虑常量函数
f(x)=0
。什么是f^-1(42)
?对于一个反函数,它必须既是注入又是满射。For integers you can do:
The factorial for real numbers has no inverse. You say that "each function must have an inverse". That is incorrect. Consider the constant function
f(x)=0
. What isf^-1(42)
? For a function to be inverse it must be both an injection and a surjection.