## 2020年6月7日日曜日

### 数学 - Python - 線形代数学 - 行列式 - 行列式の存在 - 全ての階数の導関数をもつ関数、行列式の導関数

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

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

コード

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

print('9.')

class TestMatrixDetDerivative(TestCase):
def test(self):
f = Function('f')(t)
g = Function('g')(t)
a = Matrix([[f, g],
[f.diff(t, 1), g.diff(t, 1)]]).det().diff(t, 1)
b = Matrix([[f, g],
[f.diff(t, 2), g.diff(t, 2)]]).det()
self.assertEqual(a, b)

if __name__ == "__main__":
main()


% ./sample9.py -v
9.
test (__main__.TestMatrixDetDerivative) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.019s

OK
%
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 1, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://www.mkamimura.com/2020/06/Mathematics-Python-Linear-algebra-Determinants-Existence-of-determinants-Functions-with-derivatives-of-all-ranks-derivatives-of-determinants.html", "fetch_time": 1723144494000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2024-33/segments/1722640740684.46/warc/CC-MAIN-20240808190926-20240808220926-00737.warc.gz", "warc_record_offset": 707547704, "warc_record_length": 23046, "token_count": 659, "char_count": 1573, "score": 3.984375, "int_score": 4, "crawl": "CC-MAIN-2024-33", "snapshot_type": "latest", "language": "en", "language_score": 0.2060457468032837, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00046-of-00064.parquet"}