## 2018年9月9日日曜日

### 数学 - Python - 線形代数学 - 多項式と素因子分解 – 多項式のα-進展開(3-進展開)

ラング線形代数学(下)(S.ラング (著)、芹沢 正三 (翻訳)、ちくま学芸文庫)の12章(多項式と素因子分解)、7(多項式のα-進展開)、練習問題2-(a)、(b)、(c)、(d).を取り組んでみる。

1. $\begin{array}{}{c}_{0}+{c}_{1}\left(t-3\right)+{c}_{2}{\left(t-3\right)}^{2}+{c}_{3}{\left(t-3\right)}^{3}+{c}_{4}{\left(t-3\right)}^{4}\\ =\left({c}_{0}-3{c}_{1}+9{c}_{2}-27{c}_{3}+81{c}_{4}\right)+\\ \left({c}_{1}-6{c}_{2}+27{c}_{3}-108{c}_{4}\right)t+\\ \left({c}_{2}-9{c}_{3}+54{c}_{4}\right){t}^{2}+\\ \left({c}_{3}-12{c}_{4}\right){t}^{3}+\\ {c}_{4}{t}^{4}\end{array}$
$\begin{array}{}{c}_{4}=0,{c}_{3}=0,{c}_{2}=1\\ {c}_{1}-6=0\\ {c}_{1}=6\\ {c}_{0}-18+9=-1\\ {c}_{0}=8\\ 8+6\left(t-3\right)+{\left(t-3\right)}^{2}\end{array}$

2. $\begin{array}{}{c}_{4}=0,{c}_{3}=1\\ {c}_{2}-9=0\\ {c}_{2}=9\\ {c}_{1}-54+27=1\\ {c}_{1}=28\\ {c}_{0}-84+81-27=-1\\ {c}_{0}=29\\ 29+28\left(t-3\right)+9{\left(t-3\right)}^{2}+{\left(t-3\right)}^{3}\end{array}$

3. $\begin{array}{}{c}_{4}=0,{c}_{3}=0,{c}_{2}=1\\ {c}_{1}-6=0\\ {c}_{1}=6\\ {c}_{0}-18+9=3\\ {c}_{0}=12\\ 12+6\left(t-3\right)+{\left(t-3\right)}^{2}\end{array}$

4. $\begin{array}{}{c}_{4}=1\\ {c}_{3}-12=2\\ {c}_{3}=14\\ {c}_{2}-126+54=0\\ {c}_{2}=72\\ {c}_{1}-432+378-108=-1\\ {c}_{1}=161\\ {c}_{0}-483+648-378+81=5\\ {c}_{0}=137\\ 137+161\left(t-3\right)+72{\left(t-3\right)}^{2}+14{\left(t-3\right)}^{3}+{\left(t-3\right)}^{4}\end{array}$

コード(Emacs)

Python 3

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

print('1.')

t = symbols('t')
ps = [(t ** 2 - 1, [8, 6, 1]),
(t ** 3 + t - 1, [29, 28, 9, 1]),
(t ** 2 + 3, [12, 6, 1]),
(t ** 4 + 2 * t ** 3 - t + 5, [137, 161, 72, 14, 1])]

for i, (a, b) in enumerate(ps):
print(f'({chr(ord("a") + i)})')
eq = sum([c * (t - 3) ** k for k, c in enumerate(b)])
for s in [a, eq, a == eq.expand()]:
pprint(s)
print()
print()


$./sample2.py 1. (a) 2 t - 1 2 6⋅t + (t - 3) - 10 True (b) 3 t + t - 1 3 2 28⋅t + (t - 3) + 9⋅(t - 3) - 55 True (c) 2 t + 3 2 6⋅t + (t - 3) - 6 True (d) 4 3 t + 2⋅t - t + 5 4 3 2 161⋅t + (t - 3) + 14⋅(t - 3) + 72⋅(t - 3) - 346 True$