Re: How to calculate factorial of fractions?



On Nov 10, 3:18 am, Sunil <sravip...@xxxxxxxxx> wrote:
I have seen several posts as to how to calculate factorial of
fractions like using gamma method. Can any one explain it using any
approximation such as sterling's?. I am able to calculate half
fractions using gamma but not the other fractions.

For example (3.142)!


My PASCAL program to calculate 1/Gamma, Gamma, Beta, Factorial and
Binom

type
float=extended;

function ammag(x:float):float;
const
g:array [0..26] of float=(0,1,
0.57721566490153286060651209,
-6.5587807152025388e-1,-4.200263503409524e-2,
1.6653861138229149e-1,-4.219773455554434e-2,
-9.62197152787697e-3,7.21894324666310e-3,
-1.16516759185906e-3,-2.1524167411495e-4,
1.2805028238812e-4,-2.013485478079e-5,
-1.25049348214e-6,1.13302723198e-6,
-2.0563384170e-7,6.11609510e-9,5.00200764e-9,
-1.18127457e-9,1.0434267e-10,7.78226e-12,
-3.69680e-12,5.1004e-13,-2.058e-14,
-5.35e-15,1.23e-15,-1.2e-16);
var
p,q,r:float;
i:integer;
begin
p:=1; q:=1; r:=1;
while x>=2 do begin
x:=x-1; q:=q*x;
end;
while x<1 do begin
r:=r*x; x:=x+1;
end;
if x>1 then begin p:=0;
for i:=26 downto 0
do p:=p*x+g[i];
end;
result:=p/q*r;
end;

function gamma(x:float):float;
begin
gamma:=1/ammag(x);
end;

function beta(x,y:float):float;
begin
beta:=ammag(x+y)/ammag(x)/ammag(y);
end;

function fact(x:float):float;
begin
fact:=gamma(x+1);
end;

function binom(x,y:float):float;
begin
result:=ammag(x-y+1)*ammag(y+1)/ammag(x+1);
end;

.



Relevant Pages

  • Re: Randomness of digits within pi
    ... in tables of logarithms e.g.? ... fractions & powers of pi, gamma of pi etc. must also have this ...
    (sci.math)
  • Re: How to calculate factorial of fractions?
    ... fractions using gamma but not the other fractions. ... Stirling's series is an asymptotic series for the Gamma ... so we'll just round the approximation from the asymptotic ...
    (sci.math)
  • Re: How to calculate factorial of fractions?
    ... fractions using gamma but not the other fractions. ... Stirling's series is an asymptotic series for the Gamma ... so we'll just round the approximation from the asymptotic ...
    (sci.math)
  • Re: How to calculate factorial of fractions?
    ... fractions like using gamma method. ... approximation such as sterling's?. ... fractions using gamma but not the other fractions. ...
    (sci.math)
  • Re: i^3 == -i
    ... My favourite recent treatment of the Lanczos gamma approximation is at ... You can use Pugh's recommended constants from the appendices of his ...
    (comp.sys.hp48)