## 2019年4月10日水曜日

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

1. 置換積分法。

$\begin{array}{l}t={x}^{2}\\ \frac{\mathrm{dt}}{\mathrm{dx}}=2x\\ x=0,t=1\\ x=1,x=1\\ \underset{0}{\overset{1}{\int }}{e}^{\left({x}^{2}\right)}\mathrm{dx}\\ =\frac{1}{2}\underset{0}{\overset{1}{\int }}\frac{{e}^{t}}{\sqrt{t}}\mathrm{dt}\\ {e}^{t}=1+t+\frac{1}{2!}{t}^{2}+\frac{1}{3!}{t}^{3}+\frac{1}{4!}{t}^{4}+\frac{1}{5!}{t}^{5}+{R}_{6}\left(t\right)\\ {R}_{6}\left(t\right)\le e·\frac{{t}^{6}}{6!}\le 3·\frac{{t}^{6}}{6!}=\frac{{t}^{6}}{240}\end{array}$

よって、

$\begin{array}{l}\frac{{e}^{t}}{\sqrt{t}}=\frac{1}{\sqrt{t}}+\sqrt{t}+\frac{1}{2!}t\sqrt{t}+\frac{1}{3!}{t}^{2}\sqrt{t}+\frac{1}{4!}t\sqrt[3]{t}+\frac{1}{5!}t\sqrt[4]{t}+\frac{{R}_{6}\left(t\right)}{\sqrt{t}}\\ \left|\frac{{R}_{6}\left(t\right)}{\sqrt{t}}\right|\le \frac{1}{240}t\sqrt[5]{t}\end{array}$

ゆえに、

$\begin{array}{l}\frac{1}{2}\underset{0}{\overset{1}{\int }}\frac{{e}^{t}}{\sqrt{t}}\mathrm{dt}\\ ={\left[\sqrt{t}+\frac{1}{3}t\sqrt{t}+\frac{1}{5·2!}{t}^{2}\sqrt{t}+\frac{1}{7·3!}t\sqrt[3]{t}+\frac{1}{9·4!}t\sqrt[4]{t}+\frac{1}{11·5!}t\sqrt[5]{t}\right]}_{0}^{1}\\ +\frac{1}{2}\underset{0}{\overset{1}{\int }}\frac{{R}_{6}\left(t\right)}{\sqrt{t}}\mathrm{dt}\\ \frac{1}{2}\underset{0}{\overset{1}{\int }}\left|\frac{{R}_{6}\left(t\right)}{\sqrt{t}}\right|\mathrm{dt}\\ \le \frac{1}{2}·\frac{2}{13}·\frac{1}{240}\\ =\frac{1}{13·240}\\ <1{0}^{-3}\end{array}$

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

$1+\frac{1}{3}+\frac{1}{5·2!}+\frac{1}{7·3!}+\frac{1}{9·4!}+\frac{1}{11·5!}$

コード

Python 3

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

print('11-(c).')

x = symbols('x')
f = exp(x ** 2)
If = Integral(f, (x, 0, 1))
y = sum([1 / ((2 * k + 1) * factorial(k)) for k in range(6)])
g = Rational(1, 2) * \
sum([1 / ((2 * k + 1) * factorial(k)) * x ** Rational(2 * k - 1, 2)
for k in range(6)])

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

p = plot(f, g, y,
(x, 0, 5),
ylim=(0, 5),
show=False, legend=False)
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-(c).
1
⌠
⎮  ⎛ 2⎞
⎮  ⎝x ⎠
⎮ ℯ     dx
⌡
0

√π⋅erfi(1)
──────────
2

1.4626517459071815

1.4625300625300626

9/2    7/2    5/2    3/2
x      x      x      x      √x    1
──── + ──── + ──── + ──── + ── + ────
2640   432     84     20    6    2⋅√x

C:\Users\...>