## 2019年4月8日月曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 指数関数(逆数、積分、近似、剰余項の評価)

1. $\begin{array}{l}{e}^{x}=1+x+\frac{1}{2!}{x}^{2}+\frac{1}{3!}{x}^{3}+\frac{1}{4!}{x}^{4}+\frac{1}{5!}{x}^{5}+{R}_{6}\left(x\right)\\ \left|{R}_{6}\left(x\right)\right|\le e·\frac{{\left|x\right|}^{6}}{6!}\le 3·\frac{{\left|x\right|}^{6}}{6!}\\ \frac{{e}^{x}-1}{x}=1+\frac{1}{2!}x+\frac{1}{3!}{x}^{2}+\frac{1}{4!}{x}^{3}+\frac{1}{5!}{x}^{4}+\frac{{R}_{6}\left(x\right)}{x}\\ \left|\frac{{R}_{6}\left(x\right)}{x}\right|\le 3·\frac{{\left|x\right|}^{5}}{6!}=\frac{{\left|x\right|}^{5}}{6·5·4·2}\\ \underset{0}{\overset{1}{\int }}\frac{{e}^{x}-1}{x}\mathrm{dx}\\ ={\left[x+\frac{1}{2·2}{x}^{2}+\frac{1}{3·3!}{x}^{3}+\frac{1}{4·4!}{x}^{4}+\frac{1}{5·5!}{x}^{5}\right]}^{1}+\underset{0}{\overset{1}{\int }}\frac{{R}_{6}\left(x\right)}{x}\mathrm{dx}\\ \underset{0}{\overset{1}{\int }}\left|\frac{{R}_{6}\left(x\right)}{x}\right|\mathrm{dx}\\ \le \underset{0}{\overset{1}{\int }}\frac{{x}^{5}}{6·5·4·2}\mathrm{dx}\\ =\frac{1}{6·6·5·4·2}\\ =\frac{1}{1440}\\ <1{0}^{-3}\end{array}$

よって、求める積分の小数第3位までの値は

$\begin{array}{l}1+\frac{1}{2·2}+\frac{1}{3·3!}+\frac{1}{4·4!}+\frac{1}{5·5!}\\ =\frac{2·3·4·5·5!+3·4·5·5·4·3+2·4·5·5·4+2·3·5·5+2·3·4}{2·3·4·5·5!}\\ =\frac{14400+3600+800+150+24}{14400}\\ =\frac{18974}{14400}\\ =1.317\dots \end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, exp, plot, factorial, Integral

print('11-(a).')

x = symbols('x')
f = (exp(x) - 1) / x
g = Integral(f, (x, 0, 1))

for o in [g, g.doit(), float(g.doit())]:
pprint(o)
print()

p = plot(f, exp(x), exp(x) - 1,
(x, -5, 5),
ylim=(-5, 5),
show=False, legend=True)
colors = ['red', 'green', 'blue', 'brown']

for s, color in zip(p, colors):
s.line_color = color

p.show()
p.save('sample11.png')


C:\Users\...>py sample11.py
11-(a).
1
⌠
⎮  x
⎮ ℯ  - 1
⎮ ────── dx
⎮   x
⌡
0

-γ + Ei(1)

1.3179021514544038

C:\Users\...>