core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since 513efc5 was
513efc5,
checked in by piotr, 8 years ago
|
Code review issues from PK addressed.
Added Taylor expansion utility function.
|
-
Property mode set to
100644
|
File size:
715 bytes
|
Line | |
---|
1 | // Use taylor series for low q to avoid cancellation error. |
---|
2 | // Note that the values differ from sasview ~ 5e-12 rather than 5e-14, but |
---|
3 | // in this case it is likely cancellation errors in the original expression |
---|
4 | // using double precision that are the source. Single precision only |
---|
5 | // requires the first 3 terms. Double precision requires the 4th term. |
---|
6 | // The fifth term is not needed, and is commented out. |
---|
7 | double J1c(double qr); |
---|
8 | double J1c(double qr) |
---|
9 | { |
---|
10 | const double qr2 = qr*qr; |
---|
11 | double sn, cn; |
---|
12 | |
---|
13 | SINCOS(qr, sn, cn); |
---|
14 | |
---|
15 | const double bes = (qr < 1.e-1) ? |
---|
16 | 1.0 + qr2*(-3./30. + qr2*(3./840. + qr2*(-3./45360.))) |
---|
17 | // + qr2*(3./3991680.))) |
---|
18 | : 3.0*(sn/qr - cn)/qr2; |
---|
19 | |
---|
20 | return bes; |
---|
21 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.