Changeset b85227d in sasmodels for doc


Ignore:
Timestamp:
Dec 14, 2017 6:16:05 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Added
Removed
  • doc/guide/plugin.rst

    ref85a09 rb85227d  
    556556 
    557557For 1D oriented shapes, an integral over all angles is usually needed for 
    558 the *Iq* function. Using symmetry and the substitution $u = \cos(\alpha)$, 
     558the *Iq* function. Given symmetry and the substitution $u = \cos(\alpha)$, 
    559559$du = -\sin(\alpha)\,d\alpha$ this becomes 
    560560 
    561561.. math:: 
    562562 
    563     I(q) &= \int_{-\pi/2}^{pi/2} \int_{-pi}^{pi} 
    564            F(q_a = q \sin(\alpha)\sin(\beta), 
    565              q_b = q \sin(\alpha)\cos(\beta), 
    566              q_c = q \cos(\alpha))^2 \sin(\alpha)\,d\beta\,d\alpha/(4\pi) \\ 
    567         &= 8/(4\pi) \int_{0}^{pi/2} \int_{0}^{\pi/2} F^2 \sin(\alpha)\,d\beta\,d\alpha \\ 
    568         &= 8/(4\pi) \int_0^1 \int_{0}^{\pi/2} F^2 \,d\beta\,du 
     563    I(q) &= \frac{1}{4\pi} \int_{-\pi/2}^{pi/2} \int_{-pi}^{pi} 
     564            F(q_a, q_b, q_c)^2 \sin(\alpha)\,d\beta\,d\alpha \\ 
     565        &= \frac{8}{4\pi} \int_{0}^{pi/2} \int_{0}^{\pi/2} 
     566            F^2 \sin(\alpha)\,d\beta\,d\alpha \\ 
     567        &= \frac{8}{4\pi} \int_1^0 \int_{0}^{\pi/2} - F^2 \,d\beta\,du \\ 
     568        &= \frac{8}{4\pi} \int_0^1 \int_{0}^{\pi/2} F^2 \,d\beta\,du 
     569 
     570for 
     571 
     572.. math:: 
     573 
     574    q_a &= q \sin(\alpha)\sin(\beta) = q \sqrt{1-u^2} \sin(\beta) \\ 
     575    q_b &= q \sin(\alpha)\cos(\beta) = q \sqrt{1-u^2} \cos(\beta) \\ 
     576    q_c &= q \cos(\alpha) = q u 
    569577 
    570578Using the $z, w$ values for Gauss-Legendre integration in "lib/gauss76.c", the 
     
    581589            double sin_beta, cos_beta; 
    582590            SINCOS(beta, sin_beta, cos_beta); 
     591            const double qa = sin_alpha * sin_beta * q; 
    583592            const double qb = sin_alpha * cos_beta * q; 
    584             const double qa = sin_alpha * sin_beta * q; 
    585             const double Fq = F(qa, qb, qc, ...); 
    586             inner_sum += GAUSS_W[j] * Fq*Fq; 
     593            const double form = Fq(qa, qb, qc, ...); 
     594            inner_sum += GAUSS_W[j] * form * form; 
    587595        } 
    588596        outer_sum += GAUSS_W[i] * inner_sum; 
     
    602610.. math:: 
    603611 
    604     I(q) &= \int_{-\pi/2}^{\pi/2} F(q_{ab} = q \sin(\alpha), 
    605             q_c = q \cos(\alpha))^2 \sin(\alpha)\,d\alpha/\pi \\ 
    606          &= (2/\pi) \int_0^1 F^2\,du 
     612    I(q) &= \frac{1}{\pi}\int_{-\pi/2}^{\pi/2} 
     613            F(q_{ab}, q_c)^2 \sin(\alpha)\,d\alpha/\pi \\ 
     614        &= \frac{2}{\pi} \int_0^1 F^2\,du 
     615 
     616for 
     617 
     618.. math:: 
     619 
     620    q_{ab} &= q \sin(\alpha) = q \sqrt{1 - u^2} \\ 
     621    q_c &= q \cos(\alpha) = q u 
     622 
    607623 
    608624with integration loop:: 
     
    612628        const double cos_alpha = 0.5*GAUSS_Z[i] + 0.5; 
    613629        const double sin_alpha = sqrt(1.0 - cos_alpha*cos_alpha); 
     630        const double qab = sin_alpha * q; 
    614631        const double qc = cos_alpha * q; 
    615         const double qab = sin_alpha * q; 
    616         const double Fq = F(qab, qc, ...); 
    617         sum += GAUSS_W[j] * Fq*Fq; 
     632        const double form = Fq(qab, qc, ...); 
     633        sum += GAUSS_W[j] * form * form; 
    618634    } 
    619635    sum *= 0.5; // = 2/pi * sum * (pi/2) / 2 
Note: See TracChangeset for help on using the changeset viewer.