source: sasmodels/sasmodels/models/lib/lanczos_gamma.c @ 5c1d341

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 5c1d341 was 5c1d341, checked in by piotr, 7 years ago

Converted MassFractalModel?
Refactored lanczos_gamma (gamln) out

  • Property mode set to 100644
File size: 538 bytes
Line 
1double lanczos_gamma(double q);
2double 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.