core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since e6f1410 was
e6f1410,
checked in by Paul Kienzle <pkienzle@…>, 7 years ago
|
examine numerical precision of J1c, sinc, j1c and log gamma
|
-
Property mode set to
100644
|
File size:
542 bytes
|
Line | |
---|
1 | double lanczos_gamma(double q); |
---|
2 | double lanczos_gamma(double q) |
---|
3 | { |
---|
4 | // Lanczos approximation to the Log 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.