27 return l * exp(-q * l / 8.0);
32 return l / (1.0 + (q * l) * (q * l));
38 const complex_t qyWdiv2 = width * qy / 2.0;
39 const complex_t qzHdiv2 = height * qz / 2.0;
47 complex_t factor = width /
M_PI;
52 return factor *
M_PI_2 * height;
53 complex_t aaa = qy * width / (
M_TWOPI);
54 complex_t aaa2 = aaa * aaa;
56 return factor *
M_PI_4 * height;
57 return factor *
M_PI_2 * height *
Math::sinc(qy * width * 0.5) / (1.0 - aaa2);
61 const complex_t ay = qy * width /
M_TWOPI;
62 const complex_t az = qz * (height / 2);
64 const auto integrand = [&](
double u) -> complex_t {
65 return sin(u) * exp_I(az * std::cos(u)) * (ay == 0. ? u : sin(ay * u) / ay);
68 return factor * integral * exp_I(az) * (height / 2);
76 const complex_t factor = height * width;
77 const complex_t qyW2 = qy * width * 0.5;
78 const complex_t qyd = qy * asymmetry;
79 const complex_t qzH = qz * height;
80 const complex_t a = qzH + qyd;
82 const double a_scale = std::abs(a);
83 const double w_scale = std::abs(qyW2);
85 if (w_scale < 1.e-5) {
88 result = exp_I(-qyd) * (0.5 + mul_I(a) / 6.);
91 result = exp_I(-qyd) * (1.0 + mul_I(a) - exp_I(a)) / (a * a);
94 const complex_t gamma_p = (a + qyW2) * 0.5;
95 const complex_t gamma_m = (a - qyW2) * 0.5;
97 result = mul_I(exp_I(-qyd) * result / (qyW2 * 2.));
99 return factor * result;
Defines M_PI and some more mathematical constants.
Defines classes RealIntegrator, ComplexIntegrator.
Declares computations in namespace ripples.
To integrate a complex function of a real variable.
complex_t integrate(const std::function< complex_t(double)> &f, double lmin, double lmax)
double sinc(double x)
sinc function:
complex_t profile_yz_cosine(complex_t qy, complex_t qz, double width, double height)
Complex form factor of cosine ripple.
complex_t profile_yz_bar(complex_t qy, complex_t qz, double width, double height)
Complex form factor of rectangular ripple (bar).
complex_t factor_x_box(complex_t q, double l)
complex_t factor_x_Lorentz(complex_t q, double l)
complex_t profile_yz_triangular(complex_t qy, complex_t qz, double width, double height, double asymmetry)
Complex form factor of triangular ripple.
complex_t factor_x_Gauss(complex_t q, double l)