## 2020年7月15日水曜日

### 数学 - Python - 解析学 - ベクトル - ベクトル積 - 微分可能な曲線、ベクトル積の微分、座標

1. $\frac{d\left(X\left(t\right)×Y\left(t\right)\right)}{\mathrm{dt}}$
$=\frac{d\left(\left({x}_{1}\left(t\right),{x}_{2}\left(t\right),{x}_{3}\left(t\right)\right)×\left({y}_{1}\left(t\right),{y}_{2}\left(t\right),{y}_{3}\left(t\right)\right)\right)}{\mathrm{dt}}$
$=\frac{d\left({x}_{2}\left(t\right){y}_{3}\left(t\right)-{x}_{3}\left(t\right){y}_{2}\left(t\right),{x}_{3}\left(t\right){y}_{1}\left(t\right)-{x}_{1}\left(t\right){y}_{3}\left(t\right),{x}_{1}\left(t\right){y}_{2}\left(t\right)-{x}_{2}\left(t\right){y}_{1}\left(t\right)\right)}{\mathrm{dt}}$
$\begin{array}{l}=\left(\frac{{\mathrm{dx}}_{2}}{\mathrm{dt}}{y}_{3}+{x}_{2}\frac{{\mathrm{dy}}_{3}}{\mathrm{dt}}-\frac{{\mathrm{dx}}_{3}}{\mathrm{dt}}{y}_{2}-{x}_{3}\frac{{\mathrm{dy}}_{2}}{\mathrm{dt}},\\ \frac{{\mathrm{dx}}_{3}}{\mathrm{dt}}{y}_{1}+{x}_{3}\frac{{\mathrm{dy}}_{1}}{\mathrm{dt}}-\frac{{\mathrm{dx}}_{1}}{\mathrm{dt}}{y}_{3}-{x}_{1}\frac{{\mathrm{dy}}_{3}}{\mathrm{dt}},\\ \frac{{\mathrm{dx}}_{1}}{\mathrm{dt}}{y}_{2}+{x}_{1}\frac{{\mathrm{dy}}_{2}}{\mathrm{dt}}-\frac{{\mathrm{dx}}_{2}}{\mathrm{dt}}{y}_{1}-{x}_{2}\frac{{\mathrm{dy}}_{1}}{\mathrm{dt}}\right)\end{array}$
$=X\left(t\right)×\frac{dY\left(t\right)}{\mathrm{dt}}+\frac{dX\left(t\right)}{\mathrm{dt}}×Y\left(t\right)$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import Matrix, Function, Derivative
from sympy.abc import t

print('10.')

x = Matrix([Function(f'x{i}')(t) for i in range(1, 4)])
y = Matrix([Function(f'y{i}')(t) for i in range(1, 4)])

class Test(TestCase):
def test(self):
self.assertEqual(
Derivative(x.cross(y), t, 1).doit(),
x.cross(Derivative(y, t, 1).doit()) +
Derivative(x, t, 1).doit().cross(y)
)

if __name__ == "__main__":
main()


% ./sample10.py -v
10.
test (__main__.Test) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.047s

OK
%