< Return to all 'math'

Renshaw's Approximation: for approximating Factorial (Gamma) Function for very small numbers


Formula:

Factorial Approximation Formula Image Wolfram Alpha compatible: (0.44265*x+e^-eulergamma)^(0.986261*x)


Derivation Notes:

Factorial (gamma extension) has a very nice approximation model, Stirling's approximation, which is very useful for large numbers, as it gets more accurate as you approach infinity.

However, Stirling's approximation is not very accurate for very small numbers, I set out to make a closed-form approximation for small numbers, namely -1/e<x<1.0

The first thought is that, factorial is an iterative multiplication problem, exponentials are also an iterative multiplication problem. Perhaps a form exists for solving (or approximating) n! that is of the form a^n. What could the variable a be?

Upon graphing the x-th root of x-factorial (gamma(x+1)) we notice a near-linear result!

Factorial Antiexponential Image

Looks can be deceiving however, it is not a linear form, and therefor the formula for factorial will not be (mx+b)^x.

Even still, because it is very very close to linear, we can use this to make a valid approximation; we just need to grab some information about the intercept, and the slope at key points:


Root Factorial Analysis Image

And from there we can make some trivial extrapolations and calculations to come up with the following formula:
x!~(0.44265*x+e^-eulergamma)^(0.986261*x)

Below, we can see just how close these two functions are to each other. They touch as they approach their local minima, and therefor get more accurate as you approach that point. So this is very useful for solving factorial (gamma-function) in the range of -1/e thru 1.0

Approximation Visual Image

The two magical constants used in this formula are derived from shifting a function of the form (a*x+e^-eulergamma)^(b*x) analytically, to match the local minima of the approximation function and factorial function, as well as adjusting the rate of the approximation function to closely match factorial's, until a desired level of accuracy is achieved for the range in which you are working. (In this case 1/e). They can be calculated to more decimal places, however I have found that just these few significant figures (a = 0.44265; b = 0.986261) are more than enough for approximating small factorials to high levels of accuracy.

-Albert Renshaw, Nov 12 2018




website counter