## 2018年2月6日火曜日

### 数学 - Python - 解析学 - 多変数の関数 - 高次偏導関数、テイラーの定理(三角関数(正弦、余弦)、極座標、累乗(べき乗)、グラディエント(gradient)、内積(ドット積、スカラー積))

1. $\frac{\partial g}{\partial r}=n{r}^{n-1}\left(\mathrm{arccos}n\theta +b\mathrm{sin}n\theta \right)$
$\frac{{\partial }^{2}g}{\partial {r}^{2}}=n\left(n-1\right){r}^{n-2}\left(\mathrm{arccos}n\theta +b\mathrm{sin}n\theta \right)$
$\frac{\partial g}{\partial \theta }={r}^{n}\left(-an\mathrm{sin}n\theta +bn\mathrm{cos}n\theta \right)$
$\frac{{\partial }^{2}r}{\partial {\theta }^{2}}={r}^{n}\left(-a{n}^{2}\mathrm{cos}n\theta -b{n}^{2}\mathrm{sin}n\theta \right)$

よって、

$\begin{array}{}\frac{{\partial }^{2}g}{\partial {r}^{2}}+\frac{1}{r}\frac{\partial g}{\partial r}+\frac{1}{{r}^{2}}\frac{{\partial }^{2}g}{\partial {\theta }^{2}}\\ ={r}^{n-2}\left(n\left(n-1\right)\left(\mathrm{arccos}n\theta +b\mathrm{sin}n\theta \right)+n\left(\mathrm{arccos}n\theta +b\mathrm{sin}n\theta \right)\\ -a{n}^{2}\mathrm{cos}n\theta -b{n}^{2}\mathrm{sin}n\theta \right)\\ ={r}^{n-2}·0\\ =0\end{array}$

コード(Emacs)

Python 3

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

r, θ, n, a, b = symbols('r, θ, n, a, b', real=True)
g = r ** n * (a * cos(n * θ) + b * sin(n * θ))
D = Derivative(g, r, 2) + 1 / r * Derivative(g, r, 1) + \
1 / r ** 2 * Derivative(g, θ, 2)
for t in [g, D, D.doit()]:
pprint(t.factor())
print()


$./sample5.py n r ⋅(a⋅cos(n⋅θ) + b⋅sin(n⋅θ)) 2 2 ∂ ⎛ n n ⎞ ∂ ⎛ n n ⎞ r ⋅───⎝a⋅r ⋅cos(n⋅θ) + b⋅r ⋅sin(n⋅θ)⎠ + r⋅──⎝a⋅r ⋅cos(n⋅θ) + b⋅r ⋅sin(n⋅θ)⎠ + 2 ∂r ∂r ────────────────────────────────────────────────────────────────────────────── 2 r 2 ∂ ⎛ n n ⎞ ───⎝a⋅r ⋅cos(n⋅θ) + b⋅r ⋅sin(n⋅θ)⎠ 2 ∂θ ────────────────────────────────── 0$