## 2018年2月3日土曜日

### 数学 - Python - 解析学 - 多変数の関数 - 高次偏導関数、テイラーの定理(微分鎖銉、グラディエント(gradient)、内積(ドット積、スカラー積))

1. $\begin{array}{}\frac{\partial z}{\partial v}\\ =\left(gradf\left(x,y\right)\right)·\left(1,-1\right)\\ =\left(\frac{\partial z}{\partial x},\frac{\partial z}{\partial y}\right)·\left(1,-1\right)\\ =\frac{\partial z}{\partial x}-\frac{\partial z}{\partial y}\end{array}$
$\begin{array}{}\frac{\partial z}{\partial u\partial v}\\ =grad\frac{\partial z}{\partial v}·\left(1,1\right)\\ =\left(\frac{{\partial }^{2}z}{\partial {x}^{2}}-\frac{{\partial }^{2}z}{\partial x\partial y},\frac{{\partial }^{2}z}{\partial y\partial x}-\frac{{\partial }^{2}z}{\partial {y}^{2}}\right)·\left(1,1\right)\\ =\frac{{\partial }^{2}z}{\partial {x}^{2}}-\frac{{\partial }^{2}z}{\partial {y}^{2}}\end{array}$

コード(Emacs)

Python 3

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

u, v = symbols('u, v')
x = u + v
y = u - v
f = Function('f')(x, y)
Dv = Derivative(f, v, 1)
Duv = Derivative(Dv, u, 1)
for t in [f, Dv, Dv.doit(), Duv, Duv.doit()]:
pprint(t)
print()
# g = Function('g')(a * x + b * y)
# z = x * f + y * g
# eq = b ** 2 * Derivative(z, x, 2) - 2 * a * b * \
#     Derivative(Derivative(z, y, 1), x, 1) + a ** 2 * Derivative(z, y, 2)
# for t in [f, g, z, eq]:
#     for s in [t, t.doit().factor()]:
#         pprint(s)
#         print()
#     print()


$./sample3.py f(u + v, u - v) ∂ ──(f(u + v, u - v)) ∂v ⎛ ∂ ⎞│ ⎛ ∂ ⎞│ ⎜───(f(ξ₁, u - v))⎟│ - ⎜───(f(u + v, ξ₂))⎟│ ⎝∂ξ₁ ⎠│ξ₁=u + v ⎝∂ξ₂ ⎠│ξ₂=u - v ⎛ 2 ⎞│ ⎛ 2 ⎞│ ⎜ ∂ ⎟│ ⎜ ∂ ⎟│ ⎜────(f(ξ₁, u - v))⎟│ - ⎜────(f(u + v, ξ₂))⎟│ ⎜ 2 ⎟│ ⎜ 2 ⎟│ ⎝∂ξ₁ ⎠│ξ₁=u + v ⎝∂ξ₂ ⎠│ξ₂=u - v ⎛ 2 ⎞│ ⎛ 2 ⎞│ ⎜ ∂ ⎟│ ⎜ ∂ ⎟│ ⎜────(f(ξ₁, u - v))⎟│ - ⎜────(f(u + v, ξ₂))⎟│ ⎜ 2 ⎟│ ⎜ 2 ⎟│ ⎝∂ξ₁ ⎠│ξ₁=u + v ⎝∂ξ₂ ⎠│ξ₂=u - v$