## 2019年1月16日水曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 曲線の長さ(パラメータ表示、累乗(べき乗、平方)、放物線、微分、対数関数、平方根)

1. $\begin{array}{}\underset{0}{\overset{2}{\int }}\sqrt{{\left(\frac{d}{\mathrm{dt}}\left(2t+1\right)\right)}^{2}+{\left(\frac{d}{\mathrm{dt}}{t}^{2}\right)}^{2}}\mathrm{dt}\\ =\underset{0}{\overset{2}{\int }}\sqrt{{2}^{2}+{\left(2t\right)}^{2}}\mathrm{dt}\\ =2\underset{0}{\overset{2}{\int }}\sqrt{1+{t}^{2}}\mathrm{dt}\end{array}$

一応微分して確認。

$\begin{array}{}\frac{1}{2}\left(t\sqrt{1+{t}^{2}}+\mathrm{log}\left(t+\sqrt{1+{t}^{2}}\right)\right)\\ =\frac{1}{2}\left(\sqrt{1+{t}^{2}}+\frac{{t}^{2}}{\sqrt{1+{t}^{2}}}+\frac{1}{t+\sqrt{1+{t}^{2}}}\left(1+\frac{t}{\sqrt{1+{t}^{2}}}\right)\right)\\ =\frac{1}{2}\left(\frac{1+2{t}^{2}}{\sqrt{1+{t}^{2}}}+\frac{1}{\sqrt{1+{t}^{2}}}\right)\\ =\sqrt{1+{t}^{2}}\end{array}$

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

$\begin{array}{}2·\frac{1}{2}{\left[t\sqrt{1+{t}^{2}}+\mathrm{log}\left(t+\sqrt{1+{t}^{2}}\right)\right]}_{0}^{2}\\ =2\sqrt{5}+\mathrm{log}\left(2+\sqrt{5}\right)\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, Derivative, plot, sqrt, Rational
from sympy import log
from sympy.plotting import plot_parametric

t = symbols('t')

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

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

for o in [I.doit(), 2 * sqrt(5) + log(2 + sqrt(5))]:
pprint(float(o))

p = plot_parametric((2 * t + 1, t ** 2, (t, -5, 0)),
(2 * t + 1, t ** 2, (t, 0, 2)),
(2 * t + 1, t ** 2, (t, 2, 5)),
legend=True,
show=False)
colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
p[i].line_color = color
p.save('sample5.png')


$python3 sample5.py 2 ⌠ ⎮ ____________________________ ⎮ ╱ 2 2 ⎮ ╱ ⎛d ⎛ 2⎞⎞ ⎛d ⎞ ⎮ ╱ ⎜──⎝t ⎠⎟ + ⎜──(2⋅t + 1)⎟ dt ⎮ ╲╱ ⎝dt ⎠ ⎝dt ⎠ ⌡ 0 asinh(2) + 2⋅√5 5.91577143017839 5.91577143017839$