## 2019年1月24日木曜日

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

1. $\begin{array}{}{\int }_{0}^{\pi }\sqrt{{\left(\frac{d}{\mathrm{dt}}\left(a\left(1-\mathrm{cos}t\right)\right)\right)}^{2}+{\left(\frac{d}{\mathrm{dt}}\left(a\left(t-\mathrm{sin}t\right)\right)\right)}^{2}}\mathrm{dt}\\ ={\int }_{0}^{\pi }\sqrt{{\left(a·\mathrm{sin}t\right)}^{2}+{\left(a\left(1-\mathrm{cos}t\right)\right)}^{2}}\mathrm{dt}\\ =a{\int }_{0}^{\pi }\sqrt{{\mathrm{sin}}^{2}t+1-2\mathrm{cos}t+{\mathrm{cos}}^{2}t}\mathrm{dt}\\ =a{\int }_{0}^{\pi }\sqrt{2-2\mathrm{cos}t}\mathrm{dt}\\ =a\sqrt{2}{\int }_{0}^{\pi }\sqrt{1-\mathrm{cos}t}\mathrm{dt}\\ =\sqrt{2}a{\int }_{0}^{\pi }\sqrt{1-\mathrm{cos}\left(\frac{t}{2}+\frac{t}{2}\right)}\mathrm{dt}\\ =\sqrt{2}a{\int }_{0}^{\pi }\sqrt{1-\left({\mathrm{cos}}^{2}\frac{t}{2}-{\mathrm{sin}}^{2}\frac{t}{2}\right)}\mathrm{dt}\\ =\sqrt{2}a{\int }_{0}^{\pi }\sqrt{1-\left(1-{\mathrm{sin}}^{2}\frac{t}{2}-{\mathrm{sin}}^{2}\frac{t}{2}\right)}\mathrm{dt}\\ =2a{\int }_{0}^{\pi }\sqrt{{\mathrm{sin}}^{2}\frac{t}{2}}\mathrm{dt}\\ =2a{\int }_{0}^{\pi }\mathrm{sin}\frac{t}{2}\mathrm{dx}\\ =2a{\left[-2\mathrm{cos}\frac{t}{2}\right]}_{0}^{\pi }\\ =-4a\left(0-1\right)\\ =4a\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

a = symbols('a', positive=True)
t = symbols('t')

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

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

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

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

xa = x.subs({a: 2})
ya = y.subs({a: 2})
p = plot_parametric((xa, ya, (t, -2 * pi, 0)),
(xa, ya, (t, 0, pi)),
(xa, ya, (t, pi, 2 * pi)),
show=False)

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


$python3 sample13.py π ⌠ ⎮ ______________________________________________ ⎮ ╱ 2 2 ⎮ ╱ ⎛∂ ⎞ ⎛∂ ⎞ ⎮ ╱ ⎜──(a⋅(t - sin(t)))⎟ + ⎜──(-a⋅cos(t) + a)⎟ dt ⎮ ╲╱ ⎝∂t ⎠ ⎝∂t ⎠ ⌡ 0 π ⌠ ⎮ _______________ a⋅⎮ ╲╱ -2⋅cos(t) + 2 dt ⌡ 0 π ⌠ ⎮ _______________ a⋅⎮ ╲╱ -2⋅cos(t) + 2 dt ⌡ 0 π ⌠ ⎮ _________ ⎮ ╱ 2⎛t⎞ 2⋅a⋅⎮ ╱ sin ⎜─⎟ dt ⎮ ╲╱ ⎝2⎠ ⌡ 0 4⋅a$