学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
ラング線形代数学(下) (ちくま学現文庫)(S.ラング (著)、芹沢 正三 (翻訳)、筑摩書房)の12章(多項式と素因子分解)、2(最大公約因子)、練習問題1の解答を求めてみる。
よって整除される。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, summation, plot
import random
print('1.')
t = symbols('t')
n, k = symbols('n, k', real=True, positive=True)
f = t ** n - 1
for n0 in range(10):
fn = f.subs({n: n0})
gn = (t - 1) * sum([t ** (n0 - i) for i in range(1, n0 + 1)])
for o in [fn, gn, fn == gn.expand()]:
pprint(o)
print()
p = plot(*[f.subs({n: n0}) for n0 in range(10)],
xlim=(-5, 5),
ylim=(-5, 5),
show=False,
legend=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for o, color in zip(p, colors):
o.line_color = color
p.show()
p.save('sample1.png')
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py sample1.py
1.
0
0
True
t - 1
t - 1
True
2
t - 1
(t - 1)⋅(t + 1)
True
3
t - 1
⎛ 2 ⎞
(t - 1)⋅⎝t + t + 1⎠
True
4
t - 1
⎛ 3 2 ⎞
(t - 1)⋅⎝t + t + t + 1⎠
True
5
t - 1
⎛ 4 3 2 ⎞
(t - 1)⋅⎝t + t + t + t + 1⎠
True
6
t - 1
⎛ 5 4 3 2 ⎞
(t - 1)⋅⎝t + t + t + t + t + 1⎠
True
7
t - 1
⎛ 6 5 4 3 2 ⎞
(t - 1)⋅⎝t + t + t + t + t + t + 1⎠
True
8
t - 1
⎛ 7 6 5 4 3 2 ⎞
(t - 1)⋅⎝t + t + t + t + t + t + t + 1⎠
True
9
t - 1
⎛ 8 7 6 5 4 3 2 ⎞
(t - 1)⋅⎝t + t + t + t + t + t + t + t + 1⎠
True
C:\Users\...>
0 コメント:
コメントを投稿