2018年1月5日金曜日

学習環境

線型代数入門(松坂 和夫(著)、岩波書店)の第5章(行列式)、6(行列式の計算)、問題1.を取り組んでみる。


    1. 105 - 30 - 8 45 - 180 = 75 + 8 · 135 = 75 + 1080 = 1155

    2. 3 - 9 - 5 - 8 = - 27 + 40 = 13

    3. 3 - 2 - 9 + 2 4 - 3 + - 6 - 1 = - 33 + 2 - 7 = - 38

    4. 1 + 4 + 3 · 3 = 5 + 9 = 14

    5. 2 40 - 3 + 9 - 56 + 18 + 4 7 - 30 = 2 · 37 - 9 · 38 - 4 · 23 = 74 - 342 - 92 = - 360

    6. 45 - 48 - 2 36 - 42 + 3 32 - 35 = - 3 + 12 - 9 = 0

    7. det ( 1 0 - 3 1 3 0 1 2 0 1 1 3 2 - 5 3 0 ) = det ( 1 0 - 3 1 0 0 10 - 1 0 1 1 3 0 - 5 9 - 2 ) = - 10 - 2 + 15 - 9 + 5 = - 130 - 14 = - 144

    8. det ( 1 0 - 2 1 0 - 2 1 1 0 1 - 3 2 0 1 2 - 3 ) = - 2 9 - 4 - - 3 - 2 + 2 + 3 = - 10 + 5 + 5 = 0

    9. det ( 0 1 2 - 3 - 1 0 0 1 0 0 0 2 3 - 1 - 4 0 ) = det ( 0 1 2 0 - 1 0 0 0 0 0 0 2 3 - 1 - 4 0 ) = det ( 0 1 2 0 - 1 0 0 0 0 0 0 2 3 0 - 2 0 ) = det ( 0 1 0 0 - 1 0 0 0 0 0 0 2 0 0 - 2 0 ) = - det ( 1 0 0 0 0 - 1 0 0 0 0 0 2 0 0 - 2 0 ) = 4

    10. det ( 1 2 3 4 0 - 7 - 10 - 13 0 - 2 - 8 - 10 0 - 1 - 2 - 7 ) = - 7 56 - 20 + 10 14 - 10 - 13 4 - 8 = - 7 · 36 + 40 + 13 · 4 = - 252 + 40 + 52 = - 160

    11. det ( 1 2 3 4 1 - 3 - 1 - 1 1 7 7 - 1 10 9 8 7 ) = det ( 1 2 3 4 0 - 5 - 4 - 5 0 5 4 - 5 0 - 11 - 22 - 33 ) = det ( 1 0 0 0 0 0 0 - 10 0 5 4 - 5 0 - 1 - 14 - 43 ) = - 10 - 70 + 4 = 660

    12. det ( 1 0 0 0 4 - 5 - 14 - 1 9 - 10 - 38 - 2 16 - 17 - 66 - 15 ) = det ( 1 0 0 0 0 - 5 - 14 - 1 0 0 - 10 0 0 - 17 - 66 - 15 ) = - 5 · 150 - - 170 = 10 - 75 + 17 = - 580

    13. det ( 1 1 1 0 0 0 0 - 1 0 1 0 - 1 - 1 1 1 0 0 1 1 1 0 1 1 1 0 ) = det ( 1 0 0 0 0 0 0 - 1 0 1 0 - 1 0 1 0 0 0 0 1 2 0 1 1 1 0 ) = det ( 0 - 1 0 1 - 1 0 0 0 0 0 1 2 1 1 2 0 ) = - det ( - 1 0 0 0 0 - 1 0 1 0 0 1 2 1 1 2 0 ) = - - 4 + - 1 = 3

    14. det ( 1 - 2 - 3 0 - 5 0 4 7 - 4 7 0 - 1 - 6 0 - 5 0 - 8 - 17 5 - 18 0 - 7 - 14 2 - 17 ) = det ( 0 0 - 4 7 - 1 - 1 0 - 5 - 3 1 5 - 18 - 5 3 2 - 17 ) = det ( 0 0 - 4 7 - 1 - 1 0 - 5 0 4 5 - 3 0 8 2 8 ) = det ( 0 - 4 7 4 5 - 3 8 2 8 ) = det ( 0 - 4 7 4 5 - 7 8 2 0 ) = det ( 0 - 4 7 4 1 0 8 2 0 ) = 0

コード(Emacs)

Python 3

#!/usr/bin/env python3
from sympy import pprint, Matrix

M1 = Matrix([1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1,
             1, 1, 0]).reshape(5, 5)
M2 = Matrix([[1, -2, -3, 0, -5],
             [2, 0, 1, -4, -3],
             [-2, 3, 0, 0, 5],
             [-5, 2, -2, 5, 7],
             [-3, -1, -5, 2, -2]])
for M in [M1, M2]:
    for t in [M, M.det()]:
        pprint(t)
        print()
    print()

入出力結果(Terminal, Jupyter(IPython))

$ ./sample1.py
⎡1  1  1  0  0⎤
⎢             ⎥
⎢1  1  0  0  1⎥
⎢             ⎥
⎢1  0  0  1  1⎥
⎢             ⎥
⎢0  0  1  1  1⎥
⎢             ⎥
⎣0  1  1  1  0⎦

3


⎡1   -2  -3  0   -5⎤
⎢                  ⎥
⎢2   0   1   -4  -3⎥
⎢                  ⎥
⎢-2  3   0   0   5 ⎥
⎢                  ⎥
⎢-5  2   -2  5   7 ⎥
⎢                  ⎥
⎣-3  -1  -5  2   -2⎦

0


$

0 コメント:

コメントを投稿