# Numerical integration of some awkward integrals

#### Question Q8.2.2

Use scipy.integrate.quad to evaluate the following definite integrals (which can also be expressed in closed form over the range given but are awkward).

(a) $$\int_0^1 \frac{x^4(1-x)^4}{1+x^2}\;\mathrm{d}x.$$ (Compare with $22/7 - \pi$).

(b) The following integral appears in the Debye theory of the heat capacity of crystals at low temperature $$\int_0^\infty \frac{x^3}{e^x-1}\;\mathrm{d}x$$ (Compare with $\pi^4/15$).

(c) The integral sometimes known as the Sophomore's dream: $$\int_0^1 x^{-x}\;\mathrm{d}x$$ (Compare the value you obtain from the summation $\sum_{n=1}^\infty n^{-n}$).

(d) $$\int_0^1 [\ln(1/x)]^p\;\mathrm{d}x$$ (Compare with $p!$ for integer $0 \le p \le 10$).

(e) $$\int_0^{2\pi} e^{z\cos\theta}\;\mathrm{d}\theta$$ (Compare with $2\pi I_0(z)$, where $I_0(z)$ is a modified Bessel function of the first kind, for $0 \le z \le 2$).

#### Solution

To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.