## 2020年6月8日月曜日

### 数学 - Python - 線形代数学 - 行列式 - 行列式の存在 - 3次元、一般化、帰納法、全ての階数の導関数をもつ関数、行列式の導関数

ラング線形代数学(上) (ちくま学現文庫)(S.ラング (著)、芹沢 正三 (翻訳)、筑摩書房)の6章(行列式)、4(行列式の存在)、練習問題10の解答を求めてみる。

1. $\frac{d}{\mathrm{dt}}\mathrm{det}\left[\begin{array}{ccc}f\left(t\right)& g\left(t\right)& h\left(t\right)\\ f\text{'}\left(t\right)& g\text{'}\left(t\right)& h\text{'}\left(t\right)\\ f\text{'}\text{'}\left(t\right)& g\text{'}\text{'}\left(t\right)& h\text{'}\text{'}\left(t\right)\end{array}\right]$
$\begin{array}{l}=\frac{d}{\mathrm{dt}}f\left(t\right)\left(g\text{'}\left(t\right)h\text{'}\text{'}\left(t\right)-g\text{'}\text{'}\left(t\right)h\text{'}\left(t\right)\right)\\ -\frac{d}{\mathrm{dt}}g\left(t\right)\left(f\text{'}\left(t\right)h\text{'}\text{'}\left(t\right)-f\text{'}\text{'}\left(t\right)h\text{'}\left(t\right)\right)\\ +\frac{d}{\mathrm{dt}}h\left(t\right)\left(f\text{'}\left(t\right)g\text{'}\text{'}\left(t\right)-f\text{'}\text{'}\left(t\right)g\text{'}\left(t\right)\right)\end{array}$
$\begin{array}{l}=f\text{'}\left(t\right)\left(g\text{'}\left(t\right)h\text{'}\text{'}\left(t\right)-g\text{'}\text{'}\left(t\right)h\text{'}\left(t\right)\right)\\ +f\left(t\right)\left(g\text{'}\text{'}\left(t\right)h\text{'}\text{'}\left(t\right)+g\text{'}\left(t\right)h\text{'}\text{'}\text{'}\left(t\right)-g\text{'}\text{'}\text{'}\left(t\right)h\text{'}\left(t\right)-g\text{'}\text{'}\left(t\right)h\text{'}\text{'}\left(t\right)\right)\\ ⋮\end{array}$
$\begin{array}{l}=f\text{'}\left(t\right)g\text{'}\left(t\right)h\text{'}\text{'}\left(t\right)-f\text{'}\left(t\right)g\text{'}\text{'}\left(t\right)h\text{'}\left(t\right)\\ +f\left(t\right)g\text{'}\left(t\right)h\text{'}\text{'}\text{'}\left(t\right)-f\left(t\right)g\text{'}\text{'}\text{'}\left(t\right)h\text{'}\left(t\right)\\ -f\text{'}\left(t\right)g\text{'}\left(t\right)h\text{'}\text{'}\left(t\right)+f\text{'}\text{'}\left(t\right)g\text{'}\left(t\right)h\text{'}\left(t\right)\\ +f\text{'}\left(t\right)g\left(t\right)h\text{'}\text{'}\text{'}\left(t\right)-f\text{'}\text{'}\text{'}\left(t\right)g\left(t\right)h\text{'}\left(t\right)\\ +f\text{'}\left(t\right)g\text{'}\text{'}\left(t\right)h\text{'}\left(t\right)-f\text{'}\text{'}\left(t\right)g\text{'}\left(t\right)h\text{'}\left(t\right)\\ +f\text{'}\left(t\right)g\text{'}\text{'}\text{'}\left(t\right)h\left(t\right)-f\text{'}\text{'}\text{'}\left(t\right)g\text{'}\left(t\right)h\left(t\right)\end{array}$
$=\mathrm{det}\left[\begin{array}{ccc}f\left(t\right)& f\left(t\right)& h\left(t\right)\\ f\text{'}\left(t\right)& g\text{'}\left(t\right)& h\text{'}\left(t\right)\\ f\text{'}\text{'}\text{'}\left(t\right)& g\text{'}\text{'}\text{'}\left(t\right)& h\text{'}\text{'}\text{'}\left(t\right)\end{array}\right]$

一般化。

$\frac{d}{\mathrm{dt}}\mathrm{det}\left[\begin{array}{ccc}{f}_{1}\left(t\right)& \dots & {f}_{n}\left(t\right)\\ {f}_{1}^{\left(1\right)}\left(t\right)& \dots & {f}_{n}^{\left(1\right)}\left(t\right)\\ ⋮& & ⋮\\ {f}_{1}^{\left(n-1\right)}\left(t\right)& \dots & {f}_{n}^{\left(n-1\right)}\left(t\right)\end{array}\right]=\mathrm{det}\left[\begin{array}{ccc}{f}_{1}\left(t\right)& \dots & {f}_{n}\left(t\right)\\ {f}_{1}^{\left(1\right)}\left(t\right)& \dots & {f}_{n}^{\left(1\right)}\left(t\right)\\ ⋮& & ⋮\\ {f}_{1}^{\left(n\right)}\left(t\right)& \dots & {f}_{n}^{\left(n\right)}\left(t\right)\end{array}\right]$

コード

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

print('10.')

class TestMatrixDetDerivative(TestCase):
def test(self):
n = 3
f = Function('f')(t)
g = Function('g')(t)
h = Function('h')(t)
a = Matrix([[f.diff(t, i), g.diff(t, i), h.diff(t, i)]
for i in range(n)]).det().diff(t, 1)
b = Matrix(
[[f.diff(t, i), g.diff(t, i), h.diff(t, i)]
for i in range(n - 1)] +
[[f.diff(t, n), g.diff(t, n), h.diff(t, n)]]).det()
self.assertEqual(a.simplify(), b.simplify())

if __name__ == "__main__":
main()


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

----------------------------------------------------------------------
Ran 1 test in 0.418s

OK
%