Post Reply 
Half-precision Γ(x+1) [HP-12C]
02-16-2020, 07:39 PM
Post: #3
RE: Half-precision Γ(x+1) [HP-12C]
(02-16-2020 05:47 PM)Albert Chan Wrote:  Very nice and compact formula, where did you get it ?
I am curious, your thread named half-precision, does a full-precision version exist ?

I rewrite below term, reduced 9 steps, all done in the stack.

\(\large c={840 x^2 + 314x + 66 \over 5040x^2 + 1464x + 419} =
{1 \over {6 - {1 \over \Large 2x + {360x+66 \over 420x-23} }}}\)

\(\Gamma(x+1) ≈ (x/e)^x \sqrt{2\pi(x+c)}\)

That was just a test. I have seen correction factors to Stirling's approximation outside the surd, so I decided to place a continued fraction inside it, hoping it to eventually assume a generalized form. If such an infinite continued fraction existed, then it would be easy to get full accuracy with minimum memory for whatever programmable calculator or computer we would like to implement it on. Anyway, here is what I have so far, in case someone is interested in finding the elusive pattern, if any:

\[x! \approx \sqrt{2\pi \left ( x + \frac{1}{6-\frac{1}{2x+\frac{6}{7-\frac{5}{3x+\frac{11}{20}}}}} \right )}\left ( \frac{x}{e} \right )^{x}\]

Here, the last denominator (11/20) is somewhat arbitrary.

I had written it using the plain continued fraction above, in 47 steps or so, but since it's not definitive, I decided to use the Horner form version. In the linked Wikipedia article there is an even more compact and more accurate formula. Scroll down to "Versions suitable for calculators" and look for Gergő Nemes's formula.

Back to the continued fraction, that was the latest one I was trying yesterday:

\[x + \frac{1}{6-\frac{1}{2x+\frac{6}{7-\frac{5}{3x+\frac{11}{8-\frac{9}{4x+\frac{16}{23-\frac{13}{5x+\frac{21}{10}}}}}}}}}\]

I think the first four or five terms are correct. The next terms don't appear to improve the approximation, so they are partially or completely wrong.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Half-precision Γ(x+1) [HP-12C] - Gerson W. Barbosa - 02-16-2020 07:39 PM
RE: Half-precision Γ(x+1) [HP-12C] - Gamo - 02-20-2020, 08:25 AM



User(s) browsing this thread: 3 Guest(s)