core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Rev | Line | |
---|
[5c1d341] | 1 | double lanczos_gamma(double q); |
---|
| 2 | double lanczos_gamma(double q) |
---|
| 3 | { |
---|
| 4 | // Lanczos approximation to the Gamma function. |
---|
| 5 | |
---|
| 6 | double x,y,tmp,ser; |
---|
| 7 | double coeff[6]= |
---|
| 8 | {76.18009172947146, -86.50532032941677, |
---|
| 9 | 24.01409824083091, -1.231739572450155, |
---|
| 10 | 0.1208650973866179e-2,-0.5395239384953e-5}; |
---|
| 11 | |
---|
| 12 | y=x=q; |
---|
| 13 | tmp = x+5.5; |
---|
| 14 | tmp -= (x+0.5)*log(tmp); |
---|
| 15 | ser = 1.000000000190015; |
---|
| 16 | for (int j=0; j<=5; j++) { |
---|
| 17 | y+=1.0; |
---|
| 18 | ser += coeff[j]/y; |
---|
| 19 | } |
---|
| 20 | return -tmp+log(2.5066282746310005*ser/x); |
---|
| 21 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.