## 2019年9月12日木曜日

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

ラング線形代数学(下) (ちくま学現文庫)(S.ラング (著)、芹沢 正三 (翻訳)、筑摩書房)の12章(多項式と素因子分解)、7(多項式の α - 進展開)、練習問題2の解答を求めてみる。

1. $\begin{array}{l}a+b\left(t-3\right)+c{\left(t-3\right)}^{2}\\ =a+bt-3b+c{t}^{2}-6ct+9c\\ a-3b+9c=-1\\ b-6c=0\\ c=1\\ b=6\\ a-18+9=-1\\ a=8\end{array}$

よって、問題の 多項式の3-進展開は、

$\begin{array}{l}{t}^{2}-1\\ =8+6\left(t-3\right)+{\left(t-3\right)}^{2}\end{array}$

2. $\begin{array}{l}a+b\left(t-3\right)+c{\left(t-3\right)}^{2}+{\left(t-3\right)}^{3}\\ =a+bt-3b+c{t}^{2}-6ct+9c+{t}^{3}-9{t}^{2}+27t-27\\ c-9=0\\ c=9\\ b-54+27=1\\ b=28\\ a-84+81-27=-1\\ a=29\\ {t}^{3}+t-1\\ =29+28\left(t-3\right)+9{\left(t-3\right)}^{2}+{\left(t-3\right)}^{3}\end{array}$

3. $\begin{array}{l}a+b\left(t-3\right)+{\left(t-3\right)}^{2}\\ =a+bt-3b+{t}^{2}-6t+9\\ b-6=0\\ b=6\\ a-18+9=3\\ a=12\\ {t}^{2}+3\\ =12+6\left(t-3\right)+{\left(t-3\right)}^{2}\end{array}$

4. $\begin{array}{l}a+b\left(t-3\right)+c{\left(t-3\right)}^{2}+d{\left(t-3\right)}^{3}+{\left(t-3\right)}^{4}\\ =a+bt-3b+c{t}^{2}-6ct+9c+d{t}^{3}-9d{t}^{2}+27\mathrm{dt}-27d\\ +{t}^{4}-12{t}^{3}+54{t}^{2}-108t+81\\ d-12=2\\ d=14\\ c-126+54=0\\ c=72\\ b-432+378-108=-1\\ b=161\\ a-483+648-378+81=5\\ a=137\\ {t}^{4}+2{t}^{3}-t+5\\ =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}$

コード

Python 3

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

print('2.')

class MyTest(TestCase):
def setUp(self):
pass

def tearDown(self):
pass

def test(self):
t = symbols('t')
coefficients1 = [(-1, 0, 1),
(-1, 1, 0, 1),
(3, 0, 1),
(5, -1, 0, 2, 1)]
coefficients2 = [(8, 6, 1),
(29, 28, 9, 1),
(12, 6, 1),
(137, 161, 72, 14, 1)]

for cs1, cs2 in zip(coefficients1, coefficients2):
self.assertEqual(
sum([c * t ** i for i, c in enumerate(cs1)]),
sum([c * (t - 3) ** i for i, c in enumerate(cs2)]).expand())

if __name__ == '__main__':
main()


C:\Users\...>py sample2.py
2.
.
----------------------------------------------------------------------
Ran 1 test in 0.010s

OK

C:\Users\...>