学習環境
- Surface Go、タイプ カバー、ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
ラング線形代数学(上)(S.ラング (著)、芹沢 正三 (翻訳)、ちくま学芸文庫)の2章(ベクトル空間)、2(定義)、練習問題8.を取り組んでみる。
任意の有理数
に対して、
よって、加法、乗法について閉じている。
よって、加法、乗法の逆元を含む。
よって、加法、手法の単位元を含む。
ゆえに体である。
コード(Emacs)
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, I
print('8.')
a, b, c, d = symbols('a, b, c, d', rational=True)
x = a + b * I
y = c + d * I
for t in [x, y, x + y, x * y, x ** -1, - x,
1 / (1 + 2 * I) * (1 - 2 * I) / (1 - 2 * I)]:
for s in [t.expand(), t.as_real_imag()]:
pprint(t)
print()
for s in t.as_real_imag():
print(s.is_rational)
print()
print()
入出力結果(Terminal, cmd(コマンドプロンプト), Jupyter(IPython))
$ ./sample8.py
8.
a + ⅈ⋅b
a + ⅈ⋅b
True
True
c + ⅈ⋅d
c + ⅈ⋅d
True
True
a + ⅈ⋅b + c + ⅈ⋅d
a + ⅈ⋅b + c + ⅈ⋅d
True
True
(a + ⅈ⋅b)⋅(c + ⅈ⋅d)
(a + ⅈ⋅b)⋅(c + ⅈ⋅d)
True
True
1
───────
a + ⅈ⋅b
1
───────
a + ⅈ⋅b
None
None
-a - ⅈ⋅b
-a - ⅈ⋅b
True
True
2
(1 - 2⋅ⅈ) ⋅(1 + 2⋅ⅈ)
────────────────────
25
2
(1 - 2⋅ⅈ) ⋅(1 + 2⋅ⅈ)
────────────────────
25
True
True
$
0 コメント:
コメントを投稿