## 2020年2月27日木曜日

### 数学 - Python - 解析学 - 多変数の関数 - ベクトルの微分 - 微分係数 - 曲線、ある点における接線の方程式

1. $\begin{array}{l}X\text{'}\left(t\right)\\ =\frac{d}{\mathrm{dt}}\left(\mathrm{cos}4t,\mathrm{sin}4t,t\right)\\ =\left(-4\mathrm{sin}4t,4\mathrm{cos}4t,1\right)\\ X\text{'}\left(\frac{\pi }{8}\right)\\ =\left(-4\mathrm{sin}\frac{\pi }{2},4\mathrm{cos}\frac{\pi }{2},1\right)\\ =\left(-4,0,1\right)\\ X\left(\frac{\pi }{8}\right)=\left(0,1,\frac{\pi }{8}\right)\end{array}$

よって、 求める曲線の接線のパラメーター方程式は

$L\left(t\right)=\left(0,1,\frac{\pi }{8}\right)+t\left(-4,0,1\right)$

2. $\begin{array}{l}\left\{\begin{array}{l}t=1\\ 2t=2\\ {t}^{2}=1\end{array}\\ t=1\\ X\text{'}\left(t\right)=\left(1,2,2t\right)\\ X\text{'}\left(1\right)=\left(1,2,2\right)\\ L\left(t\right)=\left(1,2,1\right)+t\left(1,2,2\right)\end{array}$

3. $\begin{array}{l}X\left(1\right)=\left({e}^{3},{e}^{-3},3\sqrt{2}\right)\\ X\text{'}\left(t\right)=\left(3{e}^{3t},-3{e}^{-3t},3\sqrt{2}\right)\\ X\text{'}\left(1\right)=\left(3{e}^{3},-3{e}^{-3},3\sqrt{2}\right)\\ L\left(t\right)=\left({e}^{3},{e}^{-3},3\sqrt{2}\right)+t\left(3{e}^{3},-3{e}^{-3},3\sqrt{2}\right)\end{array}$

4. $\begin{array}{l}X\text{'}\left(t\right)=\left(1,3{t}^{2},4{t}^{3}\right)\\ X\text{'}\left(1\right)=\left(1,3,4\right)\\ L\left(t\right)=\left(1,1,1\right)+t\left(1,3,4\right)\end{array}$

コード

#!/usr/bin/env python3
from sympy import symbols, sin, cos, pi, exp, sqrt, solve, pprint
from sympy.plotting import plot3d, plot3d_parametric_line

print('16.')

t, x, y = symbols('t, x, y', real=True)
fs = [(cos(4 * t), sin(4 * t), t),
(t, 2 * t, t ** 2),
(exp(3 * t), exp(-3 * t), 3 * sqrt(2) * 2),
(t, t ** 3, t ** 4)]
gs = [(-4 * t, 1, pi / 8 * t),
(1 + t, 2 * 2 * t, 1 + 2 * t),
(exp(3) + 3 * exp(3) * t, exp(-3) - 3 *
exp(-3) * t, 3 * sqrt(2) + 3 * sqrt(2) * t),
(1 + t, 1 + 3 * t, 1 + 4 * t)]

colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

for i, (f, g) in enumerate(zip(fs, gs), 1):
ch = chr(ord('a') + i)
try:
p = plot3d_parametric_line(*f, legend=True, show=False)
p.append(plot3d_parametric_line(*g, legend=True, show=False)[0])
for s, color in zip(p, colors):
s.line_color = color
p.save(f"sample16_{ch}.png")
except Exception as err:
print(ch, err)


% ./sample16.py
16.
b iteration over a 0-d array
d iteration over a 0-d array
%