core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since e2af2a9 was
e7678b2,
checked in by piotr, 8 years ago
|
Code review from PAK
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[e7678b2] | 1 | /** |
---|
| 2 | * Bessel function 2*J1(x)/x |
---|
| 3 | * |
---|
| 4 | * Used for low q to avoid cancellation error. |
---|
| 5 | */ |
---|
| 6 | double J1c(double x); |
---|
| 7 | double J1c(double x) |
---|
| 8 | { |
---|
| 9 | const double ax = fabs(x); |
---|
| 10 | if (ax < 8.0) { |
---|
| 11 | const double y = x*x; |
---|
| 12 | const double ans1 = 2.0*(72362614232.0 |
---|
| 13 | + y*(-7895059235.0 |
---|
| 14 | + y*(242396853.1 |
---|
| 15 | + y*(-2972611.439 |
---|
| 16 | + y*(15704.48260 |
---|
| 17 | + y*(-30.16036606)))))); |
---|
| 18 | const double ans2 = 144725228442.0 |
---|
| 19 | + y*(2300535178.0 |
---|
| 20 | + y*(18583304.74 |
---|
| 21 | + y*(99447.43394 |
---|
| 22 | + y*(376.9991397 |
---|
| 23 | + y)))); |
---|
| 24 | return ans1/ans2; |
---|
| 25 | } else { |
---|
| 26 | const double y = 64.0/(ax*ax); |
---|
| 27 | const double xx = ax - 2.356194491; |
---|
| 28 | const double ans1 = 1.0 |
---|
| 29 | + y*(0.183105e-2 |
---|
| 30 | + y*(-0.3516396496e-4 |
---|
| 31 | + y*(0.2457520174e-5 |
---|
| 32 | + y*-0.240337019e-6))); |
---|
| 33 | const double ans2 = 0.04687499995 |
---|
| 34 | + y*(-0.2002690873e-3 |
---|
| 35 | + y*(0.8449199096e-5 |
---|
| 36 | + y*(-0.88228987e-6 |
---|
| 37 | + y*0.105787412e-6))); |
---|
| 38 | double sn,cn; |
---|
| 39 | SINCOS(xx, sn, cn); |
---|
| 40 | const double ans = sqrt(0.636619772/ax) |
---|
| 41 | * (cn*ans1 - (8.0/ax)*sn*ans2)*2.0/x; |
---|
| 42 | return (x < 0.0) ? -ans : ans; |
---|
| 43 | } |
---|
| 44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.