## 2018年2月2日金曜日

### 数学 - Python - 解析学 - 多変数の関数 - 高次偏導関数、テイラーの定理(合成関数の微分法)

1. $t=ax+by$
$\frac{\partial z}{\partial x}=f\left(t\right)+axf\text{'}\left(t\right)+ayg\text{'}\left(t\right)$
$\begin{array}{}\frac{{\partial }^{2}z}{\partial {x}^{2}}=af\text{'}\left(t\right)+af\text{'}\left(t\right)+{a}^{2}xf\text{'}\text{'}\left(f\right)+{a}^{2}yg\text{'}\text{'}\left(t\right)\\ =2af\text{'}\left(t\right)+{a}^{2}xf\text{'}\text{'}\left(t\right)+{a}^{2}yg\text{'}\text{'}\left(t\right)\end{array}$
$\frac{\partial z}{\partial y}=g\left(t\right)+byg\text{'}\left(t\right)+bxf\text{'}\left(t\right)$
$\begin{array}{}\frac{{\partial }^{2}z}{\partial {y}^{2}}=bg\text{'}\left(t\right)+bg\text{'}\left(t\right)+{b}^{2}yg\text{'}\text{'}\left(t\right)+{b}^{2}xf\text{'}\text{'}\left(t\right)\\ =2bg\text{'}\left(t\right)+{b}^{2}yg\text{'}\text{'}\left(t\right)+{b}^{2}xf\text{'}\text{'}\left(t\right)\end{array}$
$\frac{{\partial }^{2}z}{\partial x\partial y}=ag\text{'}\left(t\right)+abyg\text{'}\text{'}\left(t\right)+bf\text{'}\left(t\right)+abxf\text{'}\text{'}\left(t\right)$
${b}^{2}\frac{{\partial }^{2}z}{\partial {x}^{2}}=2a{b}^{2}f\text{'}\left(t\right)+{a}^{2}{b}^{2}xf\text{'}\text{'}\left(t\right)+{a}^{2}{b}^{2}yg\text{'}\text{'}\left(t\right)$
${a}^{2}\frac{{\partial }^{2}z}{\partial {y}^{2}}=2{a}^{2}bg\text{'}\left(t\right)+{a}^{2}{b}^{2}yg\text{'}\text{'}\left(t\right)+{a}^{2}{b}^{2}xf\text{'}\text{'}\left(t\right)$
$2ab\frac{{\partial }^{2}z}{\partial x\partial y}=2{a}^{2}bg\text{'}\left(t\right)+2{a}^{2}{b}^{2}yg\text{'}\text{'}\left(t\right)+2a{b}^{2}f\text{'}\left(t\right)+2{a}^{2}{b}^{2}xf\text{'}\text{'}\left(t\right)$

よって、

${b}^{2}\frac{{\partial }^{2}z}{\partial {x}^{2}}-2ab\frac{{\gamma }^{2}z}{\partial x\partial y}+{a}^{2}\frac{{\partial }^{2}z}{\partial {y}^{2}}=0$

コード(Emacs)

Python 3

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

a, b, x, y = symbols('a, b, x, y')
f = Function('f')(a * x + b * y)
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(a⋅x + b⋅y) f(a⋅x + b⋅y) g(a⋅x + b⋅y) g(a⋅x + b⋅y) x⋅f(a⋅x + b⋅y) + y⋅g(a⋅x + b⋅y) x⋅f(a⋅x + b⋅y) + y⋅g(a⋅x + b⋅y) 2 ⎛ ⎛ 2 ⎞│ 2 ∂ ⎜ ⎜ d ⎟│ a ⋅───(x⋅f(a⋅x + b⋅y) + y⋅g(a⋅x + b⋅y)) - 2⋅a⋅b⋅⎜a⋅b⋅x⋅⎜────(f(ξ₁))⎟│ 2 ⎜ ⎜ 2 ⎟│ ∂y ⎝ ⎝dξ₁ ⎠│ξ₁=a⋅x + ⎛ 2 ⎞│ ⎜ d ⎟│ ⎛ d ⎞│ ⎛ d + a⋅b⋅y⋅⎜────(g(ξ₁))⎟│ + a⋅⎜───(g(ξ₁))⎟│ + b⋅⎜───( ⎜ 2 ⎟│ ⎝dξ₁ ⎠│ξ₁=a⋅x + b⋅y ⎝dξ₁ b⋅y ⎝dξ₁ ⎠│ξ₁=a⋅x + b⋅y ⎞ 2 ⎞│ ⎟ 2 ∂ f(ξ₁))⎟│ ⎟ + b ⋅───(x⋅f(a⋅x + b⋅y) + y⋅g(a⋅x + b⋅y)) ⎠│ξ₁=a⋅x + b⋅y⎟ 2 ⎠ ∂x 0$