Re: How to calculate factorial of fractions?
- From: GetSet2NetBet@xxxxxxxxx
- Date: Fri, 23 Nov 2007 02:53:34 -0800 (PST)
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;
.
- References:
- How to calculate factorial of fractions?
- From: Sunil
- How to calculate factorial of fractions?
- Prev by Date: Re: Confirmation of Shannon's Mistake about Perfect Secrecy of One-time-pad
- Next by Date: Re: Algebra with root and Z_2[x].
- Previous by thread: Re: How to calculate factorial of fractions?
- Next by thread: Re: How to calculate factorial of fractions?
- Index(es):
Relevant Pages
|