2020年6月3日水曜日

学習環境

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



    1. det[1x1x121x2x221x3x32]=det[1000x2-x1x22-x120x3-x1x32-x12]=x2-x1x32-x12-x22-x12x3-x1=x2-x1x3-x1x3+x1-x2+x1=x2-x1x3-x1x3-x2

      (証明終)


    2. det[1x1x1n-11x2x2n-1none1xnxnn-1]
      =det[10000x2-x1x22-x2x1x2n-1-x2n-2x1none0xn-x1xn2-xnx1xnn-1-xnn-2x1]
      =xn-x1xn-1-x1··x2-x1det[nx2x2n-21x3x3n-2none1xnxnn-2]

      よって、帰納法により、

      det[1x1x1n-11x2x2n-1none1xnxnn-1]=i<jxj-xi

      が成り立つ。

      (証明終)

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import symbols, Matrix

print('5.')


class TestMatrixDet(TestCase):
    def test_a(self):
        x1, x2, x3 = symbols('x1, x2, x3')
        v = Matrix([[x ** i for i in range(3)]
                    for x in [x1, x2, x3]])
        self.assertEqual(v.det(),
                         ((x2 - x1) * (x3 - x1) * (x3 - x2)).expand())


if __name__ == "__main__":
    main()

入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))

% ./sample5.py -v
5.
test_a (__main__.TestMatrixDet) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.048s

OK
%

0 コメント:

コメントを投稿