2018年12月6日木曜日

数学 - Python - 解析学 - 重積分の変数変換 - 変数変換定理(変数変換、円、極座標、円柱座標、第一象限)

1. xy 平面上の点(x, y)を 極座標に変換。

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

ヤコビ行列式の値。

$\begin{array}{}|\begin{array}{cc}\frac{\partial x}{\partial r}& \frac{\partial x}{\partial \theta }\\ \frac{\partial r}{\partial r}& \frac{\partial y}{\partial \theta }\end{array}|\\ =|\begin{array}{cc}\mathrm{cos}\theta & \mathrm{sin}\theta \\ -r\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},x\ge 0,y\ge 0}{\iint }xy\mathrm{dx}y\\ =\underset{0\le r\le a}{\int }\underset{0\le \theta \le \frac{\pi }{2}}{\int }\left(r\mathrm{cos}\theta \right)\left(r\mathrm{sin}\theta \right)rdrd\theta \\ =\underset{0}{\overset{a}{\int }}{r}^{3}dr\underset{0}{\overset{\frac{\pi }{2}}{\int }}\mathrm{cos}\theta \mathrm{sin}\theta d\theta \pi \\ =\frac{1}{4}{\left[{r}^{4}\right]}_{0}^{a}\underset{0}{\overset{\frac{\pi }{2}}{\int }}\frac{\mathrm{sin}\left(2\theta \right)}{2}d\theta \\ =\frac{1}{8}{a}^{4}{\left[-\frac{\mathrm{cos}\left(2\theta \right)}{2}\right]}_{0}^{\frac{\pi }{2}}\\ =\frac{1}{16}{a}^{4}·\left(1+1\right)\\ =\frac{1}{8}{a}^{4}\end{array}$

コード(Emacs)

Python 3

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

print('3-(a).')

r, theta = symbols('r, θ')
a = symbols('a', nonnegative=True)
I = Integral(r ** 3 * Integral(cos(theta) * sin(theta),
(theta, 0, pi / 2)), (r, 0, a))

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


$./sample3.py 3-(a). a ⌠ ⎮ π ⎮ ─ ⎮ 2 ⎮ 3 ⌠ ⎮ r ⋅⎮ sin(θ)⋅cos(θ) dθ dr ⎮ ⌡ ⎮ 0 ⌡ 0 4 a ── 8$