## 2018年12月7日金曜日

### 数学 - Python - 解析学 - 重積分の変数変換 - 変数変換定理(変数変換、円、極座標、円柱座標、半径、三角関数(制限、余弦)、累乗(べき乗)、定積分)

1. 直交座標を極座標に変換。

$\begin{array}{}x=r\mathrm{cos}\theta \\ y=r\mathrm{sin}\theta \\ 0\le r\le a\\ 0\le \theta \le 2\pi \end{array}$

ヤコビ行列式の値。

$\begin{array}{}|\begin{array}{cc}\frac{\partial x}{\partial r}& \frac{\partial x}{\partial \theta }\\ \frac{\partial y}{\partial r}& \frac{\partial y}{\partial \theta }\end{array}|\\ =|\begin{array}{cc}\mathrm{cos}\theta & -r\mathrm{sin}\theta \\ \mathrm{sin}\theta & r\mathrm{cos}\theta \end{array}|\\ =r\left({\mathrm{cos}}^{2}\theta +{\mathrm{sin}}^{2}\theta \right)\\ =r\end{array}$

よって、 変数変換により求める積分の値は、

$\begin{array}{}\underset{{x}^{2}+{y}^{2}\le {a}^{2}}{\iint }\left(p{x}^{2}+q{y}^{2}\right)\mathrm{dx}\mathrm{dy}\\ =\underset{0\le r\le a}{\int }\underset{0\le \theta \le 2\pi }{\int }\left(p{r}^{2}{\mathrm{cos}}^{2}\theta +q{r}^{2}{\mathrm{sin}}^{2}\theta \right)rdrd\theta \\ =\underset{0}{\overset{a}{\int }}{r}^{3}dr\underset{0}{\overset{2\pi }{\int }}\left(p{\mathrm{cos}}^{2}\theta +q{\mathrm{sin}}^{2}\theta \right)d\theta \\ ={\left[\frac{1}{4}{r}^{4}\right]}_{0}^{\alpha }\left(p\underset{0}{\overset{2\pi }{\int }}{\mathrm{cos}}^{2}\theta d\theta +q\underset{0}{\overset{2\pi }{\int }}{\mathrm{sin}}^{2}\theta d\theta \right)\\ \underset{0}{\overset{2\pi }{\int }}{\mathrm{cos}}^{2}\theta d\theta \\ ={\left[\frac{1}{2}\mathrm{cos}\theta \mathrm{sin}\theta \right]}_{0}^{2\pi }+\frac{1}{2}\underset{0}{\overset{2\pi }{\int }}1d\theta \\ =\frac{1}{2}{\left[\theta \right]}_{0}^{2\pi }\\ =\pi \\ \underset{0}{\overset{2\pi }{\int }}{\mathrm{sin}}^{2}\theta d\theta \\ ={\left[-\frac{1}{2}\mathrm{sin}\theta \mathrm{cos}\theta \right]}_{0}^{2\pi }+\frac{1}{2}{\int }_{0}^{2\pi }1df\\ =\pi \\ \frac{1}{4}{a}^{4}\left(p\pi +q\pi \right)\\ =\frac{1}{4}\pi {a}^{4}\left(p+q\right)\end{array}$

コード(Emacs)

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, pi, sin, cos

print('3-(b).')

r, theta = symbols('r, θ')
a = symbols('a', nonnegative=True)
p, q = symbols('p, q', real=True)

I = Integral(r ** 3 * Integral(p * sin(theta) ** 2 + q *
cos(theta) ** 2, (theta, 0, 2 * pi)), (r, 0, a))

for t in [I, I.doit()]:
pprint(t)
print()


$./sample3.py 3-(b). a ⌠ ⎮ 2⋅π ⎮ ⌠ ⎮ 3 ⎮ ⎛ 2 2 ⎞ ⎮ r ⋅ ⎮ ⎝p⋅sin (θ) + q⋅cos (θ)⎠ dθ dr ⎮ ⌡ ⎮ 0 ⌡ 0 4 ⎛π⋅p π⋅q⎞ a ⋅⎜─── + ───⎟ ⎝ 4 4 ⎠$