## 2019年1月22日火曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 曲線の長さ(三角関数(正弦と余弦)、対数関数)

1. $\begin{array}{}\underset{0}{\overset{\frac{\pi }{3}}{\int }}\sqrt{1+{\left(\frac{d}{\mathrm{dx}}\mathrm{log}\left(\mathrm{cos}x\right)\right)}^{2}}\mathrm{dx}\\ =\underset{0}{\overset{\frac{\pi }{3}}{\int }}\sqrt{1+{\left(\frac{-\mathrm{sin}x}{\mathrm{cos}x}\right)}^{2}}\mathrm{dx}\\ =\underset{0}{\overset{\frac{\pi }{3}}{\int }}\sqrt{1+\frac{{\mathrm{sin}}^{2}x}{{\mathrm{cos}}^{2}x}}\mathrm{dx}\\ =\underset{0}{\overset{\frac{\pi }{3}}{\int }}\sqrt{\frac{{\mathrm{cos}}^{2}x+{\mathrm{sin}}^{2}x}{{\mathrm{cos}}^{2}x}}\mathrm{dx}\\ =\underset{0}{\overset{\frac{\pi }{3}}{\int }}\frac{1}{\mathrm{cos}x}\mathrm{dx}\end{array}$

微分を試行錯誤。

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

よって、求める曲線との長さは、

$\begin{array}{}{\left[\mathrm{log}\frac{\mathrm{cos}x}{1-\mathrm{sin}x}\right]}_{0}^{\frac{\pi }{3}}\\ =\mathrm{log}\frac{\mathrm{cos}\frac{\pi }{3}}{1-\mathrm{sin}\frac{\pi }{3}}-\mathrm{log}\frac{1}{1}\\ =\mathrm{log}\left(\frac{1}{2}·\frac{1}{1-\frac{\sqrt{3}}{2}}\right)\\ =\mathrm{log}\frac{1}{2-\sqrt{3}}\\ =\mathrm{log}\frac{2+\sqrt{3}}{\left(2-\sqrt{3}\right)\left(2+\sqrt{3}\right)}\\ =\mathrm{log}\left(2+\sqrt{3}\right)\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, Derivative, plot, sqrt
from sympy import log, cos, pi

x = symbols('x', real=True)

f = log(cos(x))
I = Integral(1 / cos(x), (x, 0, pi / 3))

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

for o in [I.doit(), log(2 + sqrt(3))]:
print(float(o))

p = plot((f, (x, -4 * pi / 9, 0)),
(f, (x, 0, pi / 3)),
(f, (x, pi / 3, 4 * pi / 9)),
legend=True,
show=False)
colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
p[i].line_color = color
p.save('sample11.png')


$python3 sample11.py π ─ 3 ⌠ ⎮ 1 ⎮ ────── dx ⎮ cos(x) ⌡ 0 ⎛√3 ⎞ ⎛ √3 ⎞ log⎜── + 1⎟ log⎜- ── + 1⎟ ⎝2 ⎠ ⎝ 2 ⎠ ─────────── - ───────────── 2 2 1.3169578969248168 1.3169578969248168$