## 2019年3月26日火曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 三角関数(余弦、累乗(べき乗、平方)、置換積分方、積分、近似値(小数第3位まで))

1. 置換積分法。

$\begin{array}{}t={x}^{2}\\ \frac{\mathrm{dt}}{\mathrm{dx}}=2x\\ x=0,t=0\\ x=1,t=1\\ \underset{0}{\overset{1}{\int }}\mathrm{cos}{x}^{2}\mathrm{dx}\\ =\frac{1}{2}\underset{0}{\overset{1}{\int }}\frac{\mathrm{cos}t}{\sqrt{t}}\mathrm{dt}\end{array}$

テイラーの公式。

$\begin{array}{}\mathrm{cos}t\\ =1-\frac{{t}^{2}}{2!}+\frac{{t}^{4}}{4!}+{R}_{6}\left(t\right)\\ \left|{R}_{6}\left(t\right)\right|\le \frac{{\left|t\right|}^{6}}{6!}\end{array}$

よって、

$\begin{array}{}\frac{\mathrm{cos}t}{\sqrt{t}}\\ ={t}^{\left(-\frac{1}{2}\right)}-\frac{1}{2!}{t}^{\left(\frac{3}{2}\right)}+\frac{1}{4!}{t}^{\left(\frac{7}{2}\right)}+\frac{{R}_{6}\left(t\right)}{\sqrt{t}}\\ \left|\frac{{R}_{6}\left(t\right)}{\sqrt{t}}\right|\le \frac{{\left|t\right|}^{\left(\frac{11}{2}\right)}}{6!}\end{array}$

ゆえに、

$\begin{array}{}\frac{1}{2}\underset{0}{\overset{1}{\int }}\mathrm{cos}{x}^{2}\mathrm{dx}\\ =\frac{1}{2}{\left[2{t}^{\frac{1}{2}}-\frac{2}{5·2!}{t}^{\left(\frac{5}{2}\right)}+\frac{2}{9·4!}{t}^{\frac{9}{2}}\right]}_{0}^{1}+\frac{1}{2}\underset{0}{\overset{1}{\int }}\frac{{R}_{6}\left(t\right)}{\sqrt{x}}\mathrm{dt}\end{array}$

かつ

$\begin{array}{}\frac{1}{2}{\int }_{0}^{1}\left|\frac{{R}_{6}\left(t\right)}{\sqrt{t}}\right|\mathrm{dt}\\ =\frac{1}{2}\underset{0}{\overset{1}{\int }}\frac{{t}^{\left(\frac{11}{2}\right)}}{6!}\mathrm{dt}\\ =\frac{1}{2}{\left[\frac{2}{13·6!}{t}^{\left(\frac{13}{2}\right)}\right]}_{0}^{1}\\ =\frac{1}{13·6!}\end{array}$

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

$\begin{array}{}\frac{1}{2}{\left[2{t}^{\left(\frac{1}{2}\right)}-\frac{2}{5·2!}{t}^{\left(\frac{5}{2}\right)}+\frac{2}{9·4!}{t}^{\left(\frac{9}{2}\right)}\right]}_{0}^{1}\\ =1-\frac{1}{5·2!}+\frac{1}{9·4!}\\ =\frac{5·9·4!-9·4·3+5}{5·9·4!}\\ =\frac{1080-108+5}{1080}\\ =\frac{977}{1080}\\ =0.904...\end{array}$

コード

Python 3

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

print('11-(e).')

x = symbols('x')
f = cos(x ** 2)
i = Integral(f, (x, 0, 1))
g = 1 - x ** 2 / factorial(2) + x ** 4 / factorial(4)

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

p = plot(f, g, (x, -2, 2), 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 -3 sample11.py
11-(d).
1
⌠
⎮    ⎛ 2⎞
⎮ sin⎝x ⎠
⎮ ─────── dx
⎮    x
⌡
0

Si(1)
─────
2

0.4730415351835915

3
x    x
- ── + ─
36   2

C:\Users\...>