2018年1月16日火曜日

学習環境

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


    1. det(0100-x2x1000x1100x)=det(10000x21000x10-10x)=x4-1
      x4-1=0(x2+1)(x2-1)=0(x2+1)(x+1)(x-1)=0x=±1,±i

    2. det(0100-x2xx1-x21-x2xx-x2x01x)=det(x2x1-x2x2-1x-x2-x1x)=det(2x2x1-2x22x2-1x-2x2)010=(1-2x2)(2x2-1)-(-4x4)=-4x4+4x2-1+4x4=4x2-1
      4x2-1=0(2x+1)(2x-1)=0x=±12

コード(Emacs)

Python 3

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

x = symbols('x')
A = Matrix([x, 1, 0, 0, 0, x, 1, 0, 0, 0, x, 1, 1, 0, 0, x]).reshape(4, 4)
B = Matrix([x, 1, 0, x, 0, x, x, 1, 1, x, x, 0, x, 0, 1, x]).reshape(4, 4)

for i, M in enumerate([A, B]):
    print(f'({chr(ord("a") + i)})')
    for t in [M, M.det(), solve(M.det())]:
        pprint(t)
        print()
    print()

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

$ ./sample5.py
(a)
⎡x  1  0  0⎤
⎢          ⎥
⎢0  x  1  0⎥
⎢          ⎥
⎢0  0  x  1⎥
⎢          ⎥
⎣1  0  0  x⎦

 4    
x  - 1

[-1, 1, -ⅈ, ⅈ]


(b)
⎡x  1  0  x⎤
⎢          ⎥
⎢0  x  x  1⎥
⎢          ⎥
⎢1  x  x  0⎥
⎢          ⎥
⎣x  0  1  x⎦

   2    
4⋅x  - 1

[-1/2, 1/2]


$

0 コメント:

コメントを投稿