40 lines
821 B
Plaintext
40 lines
821 B
Plaintext
sequence c = repeat(0,12)
|
|
|
|
function gamma(atom z)
|
|
atom accm = c[1]
|
|
if accm=0 then
|
|
accm = sqrt(2*PI)
|
|
c[1] = accm
|
|
atom k1_factrl = 1 -- (k - 1)!*(-1)^k with 0!==1
|
|
for k=2 to 12 do
|
|
c[k] = exp(13-k)*power(13-k,k-1.5)/k1_factrl
|
|
k1_factrl *= -(k-1)
|
|
end for
|
|
end if
|
|
for k=2 to 12 do
|
|
accm += c[k]/(z+k-1)
|
|
end for
|
|
accm *= exp(-(z+12))*power(z+12,z+0.5) -- Gamma(z+1)
|
|
return accm/z
|
|
end function
|
|
|
|
procedure sq(atom x, atom mul)
|
|
atom p = x*mul
|
|
printf(1,"%18.16g,%18.15g\n",{x,p*p})
|
|
end procedure
|
|
|
|
procedure si(atom x)
|
|
printf(1,"%18.15f\n",{x})
|
|
end procedure
|
|
|
|
sq(gamma(-3/2),3/4)
|
|
sq(gamma(-1/2),-1/2)
|
|
sq(gamma(1/2),1)
|
|
si(gamma(1))
|
|
sq(gamma(3/2),2)
|
|
si(gamma(2))
|
|
sq(gamma(5/2),4/3)
|
|
si(gamma(3))
|
|
sq(gamma(7/2),8/15)
|
|
si(gamma(4))
|