# Changeset b85227d in sasmodels

Ignore:
Timestamp:
Dec 14, 2017 4:16:05 PM (7 years ago)
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
c654160
Parents:
ef85a09
Message:

improve latex for 1-D integration equations

File:
1 edited

### Legend:

Unmodified
 ref85a09 For 1D oriented shapes, an integral over all angles is usually needed for the *Iq* function. Using symmetry and the substitution $u = \cos(\alpha)$, the *Iq* function. Given symmetry and the substitution $u = \cos(\alpha)$, $du = -\sin(\alpha)\,d\alpha$ this becomes .. math:: I(q) &= \int_{-\pi/2}^{pi/2} \int_{-pi}^{pi} F(q_a = q \sin(\alpha)\sin(\beta), q_b = q \sin(\alpha)\cos(\beta), q_c = q \cos(\alpha))^2 \sin(\alpha)\,d\beta\,d\alpha/(4\pi) \\ &= 8/(4\pi) \int_{0}^{pi/2} \int_{0}^{\pi/2} F^2 \sin(\alpha)\,d\beta\,d\alpha \\ &= 8/(4\pi) \int_0^1 \int_{0}^{\pi/2} F^2 \,d\beta\,du I(q) &= \frac{1}{4\pi} \int_{-\pi/2}^{pi/2} \int_{-pi}^{pi} F(q_a, q_b, q_c)^2 \sin(\alpha)\,d\beta\,d\alpha \\ &= \frac{8}{4\pi} \int_{0}^{pi/2} \int_{0}^{\pi/2} F^2 \sin(\alpha)\,d\beta\,d\alpha \\ &= \frac{8}{4\pi} \int_1^0 \int_{0}^{\pi/2} - F^2 \,d\beta\,du \\ &= \frac{8}{4\pi} \int_0^1 \int_{0}^{\pi/2} F^2 \,d\beta\,du for .. math:: q_a &= q \sin(\alpha)\sin(\beta) = q \sqrt{1-u^2} \sin(\beta) \\ q_b &= q \sin(\alpha)\cos(\beta) = q \sqrt{1-u^2} \cos(\beta) \\ q_c &= q \cos(\alpha) = q u Using the $z, w$ values for Gauss-Legendre integration in "lib/gauss76.c", the double sin_beta, cos_beta; SINCOS(beta, sin_beta, cos_beta); const double qa = sin_alpha * sin_beta * q; const double qb = sin_alpha * cos_beta * q; const double qa = sin_alpha * sin_beta * q; const double Fq = F(qa, qb, qc, ...); inner_sum += GAUSS_W[j] * Fq*Fq; const double form = Fq(qa, qb, qc, ...); inner_sum += GAUSS_W[j] * form * form; } outer_sum += GAUSS_W[i] * inner_sum; .. math:: I(q) &= \int_{-\pi/2}^{\pi/2} F(q_{ab} = q \sin(\alpha), q_c = q \cos(\alpha))^2 \sin(\alpha)\,d\alpha/\pi \\ &= (2/\pi) \int_0^1 F^2\,du I(q) &= \frac{1}{\pi}\int_{-\pi/2}^{\pi/2} F(q_{ab}, q_c)^2 \sin(\alpha)\,d\alpha/\pi \\ &= \frac{2}{\pi} \int_0^1 F^2\,du for .. math:: q_{ab} &= q \sin(\alpha) = q \sqrt{1 - u^2} \\ q_c &= q \cos(\alpha) = q u with integration loop:: const double cos_alpha = 0.5*GAUSS_Z[i] + 0.5; const double sin_alpha = sqrt(1.0 - cos_alpha*cos_alpha); const double qab = sin_alpha * q; const double qc = cos_alpha * q; const double qab = sin_alpha * q; const double Fq = F(qab, qc, ...); sum += GAUSS_W[j] * Fq*Fq; const double form = Fq(qab, qc, ...); sum += GAUSS_W[j] * form * form; } sum *= 0.5; // = 2/pi * sum * (pi/2) / 2