## 2018年6月21日木曜日

### 数学 - Python - 解析学 - 積分 - 積分の計算 - 部分分数(多項式、商、係数、連立一次方程式)

1. $\begin{array}{}\left({c}_{2}+{c}_{5}\right){x}^{4}+\left({c}_{1}-3{c}_{2}\right){x}^{3}+\left(-3{c}_{1}+{c}_{2}+{c}_{4}+2{c}_{5}\right){x}^{2}\\ +\left({c}_{1}-3{c}_{2}+{c}_{3}-3{c}_{4}\right)x+\left(-3{c}_{1}-3{c}_{3}+{c}_{5}\right)\\ {c}_{2}+{c}_{5}=0\\ {c}_{5}=-{c}_{2}\\ {c}_{1}-3{c}_{2}=0\\ {c}_{1}=3{c}_{2}\\ -9{c}_{2}+{c}_{2}+{c}_{4}-2{c}_{2}=0\\ {c}_{4}=10{c}_{2}\\ 3{c}_{2}-3{c}_{2}+{c}_{3}-30{c}_{2}=2\\ {c}_{3}=30{c}_{2}+2\\ -9{c}_{2}-90{c}_{2}-6-{c}_{2}=5\\ {c}_{2}=-\frac{11}{100}\end{array}$

よって、

$\begin{array}{}{c}_{1}=-\frac{33}{100}\\ {c}_{2}=-\frac{11}{100}\\ {c}_{3}=-\frac{330}{160}+2=-\frac{130}{100}=-\frac{13}{10}\\ {c}_{4}=-\frac{110}{100}=-\frac{11}{10}\\ {c}_{5}=\frac{11}{100}\end{array}$

コード(Emacs)

Python 3

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

print('1.')
x = symbols('x')
cs = symbols(','.join([f'c{i}' for i in range(1, 6)]))
c1, c2, c3, c4, c5 = cs
l = (2 * x + 5) / ((x ** 2 + 1) ** 2 * (x - 3))
r = (c1 + c2 * x) / (x ** 2 + 1) + (c3 + c4 * x) / \
(x ** 2 + 1) ** 2 + c5 / (x - 3)

s = solve(l - r, cs, dict=True)
for t in [l, r, s]:
pprint(t)
print()


$./sample1.py 1. 2⋅x + 5 ───────────────── 2 ⎛ 2 ⎞ (x - 3)⋅⎝x + 1⎠ c₅ c₁ + c₂⋅x c₃ + c₄⋅x ───── + ───────── + ───────── x - 3 2 2 x + 1 ⎛ 2 ⎞ ⎝x + 1⎠ ⎡⎧ -33 -11 -13 -11 11⎫⎤ ⎢⎨c₁: ────, c₂: ────, c₃: ────, c₄: ────, c₅: ───⎬⎥ ⎣⎩ 100 100 10 10 100⎭⎦$