## 2019年12月26日木曜日

### 数学 - Python - 解析学 - 積分の計算 - 不定積分の計算 - 三角関数(正弦と余弦)、累乗、漸化式

1. $\begin{array}{l}\frac{d}{\mathrm{dx}}\left(\frac{{\mathrm{sin}}^{m+1}x{\mathrm{cos}}^{n·1}x}{m+n}+\frac{n-1}{m+n}\int {\mathrm{sin}}^{m}x{\mathrm{cos}}^{n-2}x\mathrm{dx}\right)\\ =\frac{\left(m+1\right){\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x+\left({\mathrm{sin}}^{m+1}x\right)\left(n-1\right)\left({\mathrm{cos}}^{n-2}x\right)\left(-\mathrm{sin}x\right)}{m+n}\\ +\frac{\left(n-1\right){\mathrm{sin}}^{m}x{\mathrm{cos}}^{n-2}x}{m+n}\\ =\frac{\left(m+1\right){\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x-\left(n-1\right)\left({\mathrm{sin}}^{n+2}x{\mathrm{cos}}^{n-2}x\right)+\left(n-1\right){\mathrm{sin}}^{m}x{\mathrm{cos}}^{n-2}x}{m+n}\\ =\frac{{\mathrm{sin}}^{m}x{\mathrm{cos}}^{n-2}x\left(\left(m+1\right){\mathrm{cos}}^{2}x-\left(n-1\right){\mathrm{sin}}^{2}x+\left(n-1\right)\right)}{m+n}\\ =\frac{{\mathrm{sin}}^{m}x{\mathrm{cos}}^{n-2}x\left(m{\mathrm{cos}}^{2}x-n{\mathrm{sin}}^{2}x+n\right)}{m+n}\\ =\frac{{\mathrm{sin}}^{m}x{\mathrm{cos}}^{n-2}x\left(m{\mathrm{cos}}^{2}x-n\left(1-{\mathrm{cos}}^{2}x\right)+n\right)}{m+n}\\ ={\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x\end{array}$

よって、

$I\left(m,n\right)=\frac{{\mathrm{sin}}^{m+1}x{\mathrm{cos}}^{n-1}x}{m+n}+\frac{n-1}{m+n}I\left(m,n-2\right)$

が成り立つ。

$\begin{array}{l}\frac{d}{\mathrm{dx}}\left(-\frac{{\mathrm{sin}}^{m-1}x{\mathrm{cos}}^{n+1}x}{m+n}+\frac{m-1}{m+n}I\left(m-2,n\right)\right)\\ =\frac{-\left(m-1\right){\mathrm{sin}}^{m-2}x{\mathrm{cos}}^{n+2}x+\left({\mathrm{sin}}^{m}x\right)\left(n+1\right){\mathrm{cos}}^{n}x}{m+n}\\ +\frac{\left(m-1\right)\left({\mathrm{sin}}^{m-2}x{\mathrm{cos}}^{n}x\right)}{m+n}\\ =\frac{{\mathrm{sin}}^{m-2}x{\mathrm{cos}}^{n}x\left(-\left(m-1\right){\mathrm{cos}}^{2}x+\left(n+1\right){\mathrm{sin}}^{2}x+\left(m-1\right)\right)}{m+n}\\ =\frac{{\mathrm{sin}}^{m-2}x{\mathrm{cos}}^{n}x\left(-m\left(1-{\mathrm{sin}}^{2}x\right)+n{\mathrm{sin}}^{2}x+m\right)}{m+n}\\ ={\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x\\ I\left(m,n\right)=-\frac{{\mathrm{sin}}^{m-1}x{\mathrm{cos}}^{n+1}x}{n1+n}+\frac{m-1}{m+n}I\left(m-2,n\right)\end{array}$

2. $\begin{array}{l}\frac{d}{\mathrm{dx}}\left(-\frac{{\mathrm{sin}}^{m+1}x{\mathrm{cos}}^{n+1}x}{n+1}+\frac{m+n+2}{n+1}I\left(m,n+2\right)\right)\\ =\frac{-\left(m+1\right){\mathrm{sin}}^{m}x{\mathrm{cos}}^{n+2}x+\left(n+1\right){\mathrm{sin}}^{m+2}x{\mathrm{cos}}^{n}x}{n+1}\\ +\frac{\left(m+n+2\right){\mathrm{sin}}^{m}x{\mathrm{cos}}^{n+2}x}{n+1}\\ =\frac{{\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x\left(-\left(m+1\right){\mathrm{cos}}^{2}x+\left(n+1\right){\mathrm{sin}}^{2}x+\left(m+n+2\right){\mathrm{cos}}^{2}x\right)}{n+1}\\ =\frac{{\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x\left(n+1\right)\left({\mathrm{cos}}^{2}x+{\mathrm{sin}}^{2}x\right)}{n+1}\\ ={\mathrm{sin}}^{n}x{\mathrm{cos}}^{n}x\end{array}$

（証明終）

3. $\begin{array}{l}\frac{d}{\mathrm{dx}}\left(\frac{{\mathrm{sin}}^{m+1}x{\mathrm{cos}}^{n+1}x}{m+1}+\frac{m+n+2}{m+1}I\left(m+2,n\right)\right)\\ =\frac{\left(m+1\right){\mathrm{sin}}^{m}x{\mathrm{cos}}^{n+2}x-\left(n+1\right){\mathrm{sin}}^{m+2}x{\mathrm{cos}}^{n}x}{m+1}\\ +\frac{\left(m+n+2\right){\mathrm{sin}}^{n+2}x{\mathrm{cos}}^{n}x}{m+1}\\ =\frac{{\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x\left(\left(m+1\right){\mathrm{cos}}^{2}x-\left(n+1\right){\mathrm{sin}}^{2}x+\left(m+n+2\right){\mathrm{sin}}^{2}x\right)}{m+1}\\ =\frac{{\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x\left(\left(m+1\right){\mathrm{cos}}^{2}x+\left(m+1\right){\mathrm{sin}}^{2}x\right)}{m+1}\\ ={\mathrm{sin}}^{m}x{\mathrm{cos}}^{n}x\end{array}$

（証明終）

コード

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

print('4.')

x = symbols('x')
m, n = symbols('m, n', integer=True)
f = sin(x) ** m * cos(x) ** n

fs = [f.subs({m: m0, n: n0})
for m0 in range(-1, 2)
for n0 in range(-1, 3)]

for g in fs:
I = Integral(g, x)
for o in [I, I.doit()]:
pprint(o)
print()

p = plot(*fs,
(x, -5, 5),
ylim=(-5, 5),
legend=False,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

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

for o in zip(fs, colors):
pprint(o)

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


% ./sample4.py
4.
⌠
⎮       1
⎮ ───────────── dx
⎮ sin(x)⋅cos(x)
⌡

⎛   2       ⎞
log⎝sin (x) - 1⎠
- ──────────────── + log(sin(x))
2

⌠
⎮   1
⎮ ────── dx
⎮ sin(x)
⌡

log(cos(x) - 1)   log(cos(x) + 1)
─────────────── - ───────────────
2                 2

⌠
⎮ cos(x)
⎮ ────── dx
⎮ sin(x)
⌡

log(sin(x))

⌠
⎮    2
⎮ cos (x)
⎮ ─────── dx
⎮  sin(x)
⌡

log(cos(x) - 1)   log(cos(x) + 1)
─────────────── - ─────────────── + cos(x)
2                 2

⌠
⎮   1
⎮ ────── dx
⎮ cos(x)
⌡

log(sin(x) - 1)   log(sin(x) + 1)
- ─────────────── + ───────────────
2                 2

⌠
⎮ 1 dx
⌡

x

⌠
⎮ cos(x) dx
⌡

sin(x)

⌠
⎮    2
⎮ cos (x) dx
⌡

x   sin(x)⋅cos(x)
─ + ─────────────
2         2

⌠
⎮ sin(x)
⎮ ────── dx
⎮ cos(x)
⌡

-log(cos(x))

⌠
⎮ sin(x) dx
⌡

-cos(x)

⌠
⎮ sin(x)⋅cos(x) dx
⌡

2
sin (x)
───────
2

⌠
⎮           2
⎮ sin(x)⋅cos (x) dx
⌡

3
-cos (x)
─────────
3

⎛      1           ⎞
⎜─────────────, red⎟
⎝sin(x)⋅cos(x)     ⎠
⎛  1          ⎞
⎜──────, green⎟
⎝sin(x)       ⎠
⎛cos(x)      ⎞
⎜──────, blue⎟
⎝sin(x)      ⎠
⎛   2          ⎞
⎜cos (x)       ⎟
⎜───────, brown⎟
⎝ sin(x)       ⎠
⎛  1           ⎞
⎜──────, orange⎟
⎝cos(x)        ⎠
(1, purple)
(cos(x), pink)
⎛   2         ⎞
⎝cos (x), gray⎠
⎛sin(x)         ⎞
⎜──────, skyblue⎟
⎝cos(x)         ⎠
(sin(x), yellow)
%