## 2020年3月5日木曜日

### 数学 - Python - 解析学 - 多変数の関数 - ベクトルの微分 - 微分係数 - 曲線とその速度ベクトルの余弦、内積、ノルム

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

よって、 曲線と速度ベクトルの余弦は、

$\begin{array}{l}\mathrm{cos}\theta \\ =\frac{X\left(t\right)·X\text{'}\left(t\right)}{∥X\left(t\right)∥∥X\text{'}\left(t\right)∥}\\ X\left(t\right)·X\text{'}\left(t\right)\\ =\left(\frac{2t}{1+{t}^{2}},\frac{1-{t}^{2}}{1+{t}^{2}},1\right)·\left(\frac{2\left(1-{t}^{2}\right)}{{\left(1+{t}^{2}\right)}^{2}},\frac{-4t}{{\left(1+{t}^{2}\right)}^{2}},0\right)\\ =\frac{2}{{\left(1+{t}^{2}\right)}^{3}}\left(2t\left(1-{t}^{2}\right)-2t\left(1-{t}^{2}\right)\right)\\ =0\end{array}$

よって、 余弦は定数である。

.

（証明終）

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, Matrix, Derivative
from sympy.plotting import plot_parametric
print('24.')

t, a, b = symbols('t, a, b', real=True)
x = Matrix([2 * t / (1 + t ** 2),
(1 - t ** 2) / (1 + t ** 2),
1])
x1 = Derivative(x, t, 1).doit()

class MyTestCase(TestCase):
def test(self):
self.assertEqual(x.dot(x1).simplify(), 0)

p = plot_parametric(*x[:2],
legend=True,
show=False)

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

for o, color in zip(p, colors):
o.line_color = color

p.show()
p.save('sample24.png')

if __name__ == "__main__":
main()

% ./sample24.py -v
24.
test (__main__.MyTestCase) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.327s

OK
%