Gamma function: Difference between revisions

m
Line 3,812:
 
function gamma_(x_) {
external _gamma_coef
x = x_
y = 1
while (x<0.5) y = y/x++
while (x>1.5) y = --x*y
z = _gamma_coef[30]
x--
for (i=29; i>=1; i--) z = z*x+_gamma_coef[i]
return(y/z)
}
function map(f,a) {
n = rows(a)
p = cols(a)
b = J(n,p,.)
for (i=1; i<=n; i++) {
for (j=1; j<=p; j++) {
b[i,j] = (*f)(a[i,j])
}
}
}
}
return(b)
}
 
1,336

edits