学習環境
- Surface 3 (4G LTE)、Surface 3 タイプ カバー、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro + Apple Pencil
- MyScript Nebo(iPad アプリ)
- 参考書籍
ラング線形代数学(上)(S.ラング (著)、芹沢 正三 (翻訳)、ちくま学芸文庫)の7章(スカラー積と直交性)、2(正値スカラー積)、練習問題2-(a)、(b).を取り組んでみる。
よって、正規直交基底は、
よって、正規直交基底は、
コード(Emacs)
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, Matrix, sqrt, Rational
print('1.')
ts = [(1 / sqrt(6) * Matrix([[1, 2, 1, 0]]),
1 / sqrt(39) * Matrix([[-1, -2, 5, 3]])),
(1 / sqrt(2) * Matrix([[1, 1, 0, 0]]),
Rational(1, 2) * Matrix([[1, -1, 1, 1]]),
1 / (3 * sqrt(2)) * Matrix([[-2, 2, 3, 1]]))]
for i, vs in enumerate(ts):
print(f'({chr(ord("a") + i)})')
for v1 in vs:
for t in [v1, v1.norm()]:
pprint(t)
print()
for v2 in vs:
pprint(v1.dot(v2))
print()
入出力結果(Terminal, Jupyter(IPython))
$ ./sample2.py 1. (a) ⎡√6 √6 √6 ⎤ ⎢── ── ── 0⎥ ⎣6 3 6 ⎦ 1 1 0 ⎡-√39 -2⋅√39 5⋅√39 √39⎤ ⎢───── ─────── ───── ───⎥ ⎣ 39 39 39 13⎦ 1 0 1 (b) ⎡√2 √2 ⎤ ⎢── ── 0 0⎥ ⎣2 2 ⎦ 1 1 0 0 [1/2 -1/2 1/2 1/2] 1 0 1 0 ⎡-√2 √2 √2 √2⎤ ⎢──── ── ── ──⎥ ⎣ 3 3 2 6 ⎦ 1 0 0 1 $
0 コメント:
コメントを投稿