## 2020年5月10日日曜日

### 数学 - Pytyhon - 解析学 - 多変数の関数 - 合成微分律と勾配ベクトル - 接平面 - 曲面、接平面の方程式、内積、累乗(平方)、累乗根(平方根)、三角関数(正弦)

1. $\begin{array}{l}grad\left({x}^{2}+{y}^{2}-z\right)\\ =\left(2x,2y,-1\right)\\ \left(2·3,2·4,-1\right)\\ =\left(6,8,-1\right)\end{array}$

よって、求める接平面の方程式は、

$\begin{array}{l}6x+8y-z=6·3+8·4-25\\ 6x+8y-z=18+32-25\\ 6x+8y-z=25\end{array}$

2. $\begin{array}{l}grad\left(\frac{x}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{1}{2}}}-z\right)\\ =\left(\frac{{\left({x}^{2}+{y}^{2}\right)}^{\frac{1}{2}}-x·\frac{1}{2}·\frac{1}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{1}{2}}}·2x}{{x}^{2}+{y}^{2}},\frac{-\frac{xy}{{\left({x}^{2}+{y}^{2}\right)}^{\frac{1}{2}}}}{{x}^{2}+{y}^{2}},-1\right)\end{array}$

点 P における勾配ベクトル。

$\begin{array}{l}\left(\frac{5-\frac{9}{5}}{25},\frac{12}{5·25},-1\right)\\ =\left(\frac{16}{5·25},\frac{12}{5·25},-1\right)\end{array}$

接平面の方程式。

$\begin{array}{l}\frac{16}{5·25}x+\frac{12}{5·25}y-z=\frac{16·3}{5·25}+\frac{12·\left(-4\right)}{5·25}-\frac{3}{5}\\ 16x+12y-125z=48-48-75\\ 16x+12y-125z=-75\end{array}$

3. $\begin{array}{l}grad\left(\mathrm{sin}\left(xy\right)-z\right)\\ =\left(y\mathrm{cos}\left(xy\right),x\mathrm{cos}\left(xy\right),-1\right)\\ \left(\pi \mathrm{cos}\pi ,\mathrm{cos}\pi ,-1\right)\\ =\left(-\pi ,-1,-1\right)\\ -\pi x-y-z=-\pi -\pi \\ \pi x+y+z=2\pi \end{array}$

コード

#!/usr/bin/env python3
from sympy import symbols, sin, sqrt, pi
from sympy.plotting import plot3d

print('5.')

x, y = symbols('x, y')

fs = [x ** 2 + y ** 2,
x / sqrt(x ** 2 + y ** 2),
sin(x * y)]
gs = [6 * x + 8 * y - 25,
(16 * x + 12 * y + 75) / 125,
(2 * pi - pi * x - y) / 2]

for i, (f, g) in enumerate(zip(fs, gs)):
c = chr(ord("a") + i)
print(f'({c})')
p = plot3d(f, g,
(x, -5, 5),
(y, -5, 5),
show=False)
p.save(f'sample5_{c}.png')

p.show()


% ./sample5.py
5.
(a)
(b)
(c)
%