## 2019年12月24日火曜日

### 数学 - Python - 解析学 - 積分の計算 - 不定積分の計算 - 真分数、因数分解、対数関数、有理関数の積分、部分分数分解

1. $\frac{P\left(x\right)}{Q\left(x\right)}=\sum _{k=1}^{n}\frac{{A}_{k}}{x-{a}_{k}}$

とおくと、

$\begin{array}{l}P\left(x\right)\\ =\sum _{k=1}^{n}{A}_{k}\left(x-{a}_{1}\right)\dots \left(x-{a}_{k-1}\right)\left(x-{a}_{k+1}\right)\dots \left(x-{a}_{n}\right)\\ P\left({a}_{k}\right)\\ ={A}_{k}\left({a}_{k}-{a}_{1}\right)\dots \left({a}_{k}-{a}_{k-1}\right)\left({a}_{k}-{a}_{k+1}\right)...\left({a}_{k}-{a}_{n}\right)\\ ={A}_{k}Q\text{'}\left({a}_{k}\right)\\ {A}_{k}=\frac{P\left({a}_{k}\right)}{Q\text{'}\left({a}_{k}\right)}={\alpha }_{k}\end{array}$

よって、

$\begin{array}{l}\int \frac{P\left(x\right)}{Q\left(x\right)}\mathrm{dx}\\ =\int \sum _{k=1}^{n}\frac{{\alpha }_{k}}{x-{a}_{k}}\mathrm{dx}\\ =\sum _{k=1}^{n}{\alpha }_{k}\mathrm{log}{\left|x-{a}_{k}\right|}^{{\alpha }_{k}}\\ =\sum _{k=1}^{n}\mathrm{log}{\left|x-{a}_{k}\right|}^{{\alpha }_{k}}\\ \equiv \mathrm{log}\left(\prod _{k=\stackrel{-}{1}}^{n}{\left|x-{a}_{k}\right|}^{{\alpha }_{k}}\right)\\ =\mathrm{log}\left|\prod _{k=1}^{n}{\left(x-{a}_{k}\right)}^{{\alpha }_{k}}\right|\end{array}$

（証明終）

コード

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral
import random
print('2.')

x = symbols('x')
n = 2
p = sum([symbols(f'b{k}', real=True) * x ** k for k in range(n)])
q = 1
for k in range(n + 1):
q *= (x - k)

f = p / q
I = Integral(f, x)

for o in [I, I.doit()]:
pprint(o.simplify())
print()


% ./sample2.py
2.
⌠
⎮     b₀ + b₁⋅x
⎮ ───────────────── dx
⎮ x⋅(x - 2)⋅(x - 1)
⌡

b₀⋅log(x)                          (b₀ + 2⋅b₁)⋅log(x - 2)
───────── - (b₀ + b₁)⋅log(x - 1) + ──────────────────────
2                                        2

%