nuqad
的用法
\begin{align}
\int_0^1\mathrm{d}y \int_y^1 \mathrm{d}x \cdot(x^2 + y) = \frac{5}{12}
\end{align}
from scipy.integrate import nquad |
(0.41666666666666663, 1.473075555508962e-14) |
定积分换元到质心系
\begin{align}
\int_0^{2\pi} \mathrm{d}\phi_k \int_0^{2\pi}\mathrm{d}\phi_q \cdot f(\phi_k - \phi_q)
= \frac{1}{2}\int_{-2\pi}^{2\pi} \mathrm{d}\phi_- \cdot l(\phi_-) f(\phi_-)
\end{align}
where
\begin{align} \phi_+ =& \phi_k + \phi_q \\ \phi_- =& \phi_k - \phi_q \\ l(\phi_-) =& \left\{\matrix{4\pi - 2\phi_-, \quad \phi_->0\\ 4\pi + 2\phi_-, \quad \phi_->0}\right. \end{align}
import numpy as np |
(-303.255886295168, 2.462030579408747e-11) |
Reference
- https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.nquad.html
- Stewart, J. Calculus. (Cengage Learning, 2016). Chap 15.9, Change of Variables in Multiple Integrals