学習環境
- Surface 3 (4G LTE)、Surface 3 タイプ カバー、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro + Apple Pencil
- MyScript Nebo(iPad アプリ)
- 参考書籍
ラング線形代数学(下)(S.ラング (著)、芹沢 正三 (翻訳)、ちくま学芸文庫)の12章(多項式と素因子分解)、1(ユークリッド算法)、練習問題1-(a)、(b)、(c)、(d).を取り組んでみる。
コード(Emacs)
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols
print('1.')
t = symbols('t')
ps = [(t ** 2 - 2 * t + 1, (t - 1) * (t - 1)),
(t ** 3 + t - 1, t * (t ** 2 + 1) - 1),
(t ** 3 + t, (t ** 2 + 1) * t),
(t ** 3 - 1, (t ** 2 + t + 1) * (t - 1))]
for i, (a, b) in enumerate(ps):
print(f'({chr(ord("a") + i)})')
for s in [a, b, a.expand() == b.expand()]:
pprint(s)
入出力結果(Terminal, Jupyter(IPython))
$ ./sample1.py
1.
(a)
2
t - 2⋅t + 1
2
(t - 1)
True
(b)
3
t + t - 1
⎛ 2 ⎞
t⋅⎝t + 1⎠ - 1
True
(c)
3
t + t
⎛ 2 ⎞
t⋅⎝t + 1⎠
True
(d)
3
t - 1
⎛ 2 ⎞
(t - 1)⋅⎝t + t + 1⎠
True
$
0 コメント:
コメントを投稿