## 2019年1月23日水曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 曲線の長さ(パラメーター表示、三角関数(正弦と余弦)、累乗(べき乗、平方)、平方根、加法定理、半角)

1. $\begin{array}{}{\int }_{0}^{2\pi }\sqrt{{\left(\frac{d}{\mathrm{dt}}\left(1-\mathrm{cos}t\right)\right)}^{2}+{\left(\frac{d}{\mathrm{dt}}\left(t-\mathrm{sin}t\right)\right)}^{2}}\mathrm{dt}\\ ={\int }_{0}^{2\pi }\sqrt{{\mathrm{sin}}^{2}t+{\left(1-\mathrm{cos}t\right)}^{2}}\mathrm{dt}\\ ={\int }_{0}^{2\pi }\sqrt{{\mathrm{sin}}^{2}t+1-2\mathrm{cos}t+{\mathrm{cos}}^{2}t}\mathrm{dt}\\ ={\int }_{0}^{2\pi }\sqrt{2-2\mathrm{cos}t}\mathrm{dt}\\ =\sqrt{2}{\int }_{0}^{2\pi }\sqrt{1-\mathrm{cos}t}\mathrm{dt}\\ =\sqrt{2}{\int }_{0}^{2tv}\sqrt{1-\mathrm{cos}\left(\frac{t}{2}+\frac{t}{2}\right)}\mathrm{dt}\\ =\sqrt{2}{\int }_{0}^{2\pi }\sqrt{1-\left({\mathrm{cos}}^{2}\frac{t}{2}-{\mathrm{sin}}^{2}\frac{t}{2}\right)}\mathrm{dt}\\ =\sqrt{2}{\int }_{0}^{2\pi }\sqrt{1-\left(\left(1-{\mathrm{sin}}^{2}\frac{t}{2}\right)-{\mathrm{sin}}^{2}\frac{t}{2}\right)}\mathrm{dt}\\ =\sqrt{2}{\int }_{0}^{2\pi }\sqrt{2{\mathrm{sin}}^{2}\frac{t}{2}}\mathrm{dt}\\ =2{\int }_{0}^{2\pi }\sqrt{{\mathrm{sin}}^{2}\frac{t}{2}}\mathrm{dt}\\ =2{\int }_{0}^{2\pi }\mathrm{sin}\frac{t}{2}\mathrm{dt}\\ =2{\left[-2\mathrm{cos}\frac{t}{2}\right]}_{0}^{2\pi }\\ =-4\left(\mathrm{cos}\pi -\mathrm{cos}0\right)\\ =-4\left(-1-1\right)\\ =8\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, Derivative, plot, sqrt, cos, sin
from sympy import pi
from sympy.plotting import plot_parametric
t = symbols('t')

x = 1 - cos(t)
y = t - sin(t)

I = Integral(sqrt(Derivative(x, t, 1) ** 2 +
Derivative(y, t, 1) ** 2), (t, 0, 2 * pi))

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

I = 2 * Integral(sqrt(sin(t / 2) ** 2), (t, 0, 2 * pi))
for o in [I, I.doit()]:
pprint(o)
print()

p = plot_parametric((x, y, (t, -2 * pi, 0)),
(x, y, (t, 0, 2 * pi)),
(x, y, (t, 2 * pi, 4 * pi)),
show=False)

colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
p[i].line_color = color
p.save('sample12.png')


$python3 sample12.py 2⋅π ⌠ ⎮ ________________________________________ ⎮ ╱ 2 2 ⎮ ╱ ⎛d ⎞ ⎛d ⎞ ⎮ ╱ ⎜──(t - sin(t))⎟ + ⎜──(-cos(t) + 1)⎟ dt ⎮ ╲╱ ⎝dt ⎠ ⎝dt ⎠ ⌡ 0 2⋅π ⌠ ⎮ _______________ ⎮ ╲╱ -2⋅cos(t) + 2 dt ⌡ 0 2⋅π ⌠ ⎮ _______________ ⎮ ╲╱ -2⋅cos(t) + 2 dt ⌡ 0 2⋅π ⌠ ⎮ _________ ⎮ ╱ 2⎛t⎞ 2⋅ ⎮ ╱ sin ⎜─⎟ dt ⎮ ╲╱ ⎝2⎠ ⌡ 0 8$