## 2019年1月17日木曜日

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

1. $\begin{array}{}\underset{-2}{\overset{2}{\int }}\sqrt{{\left(\frac{d}{\mathrm{dt}}\left(4+2t\right)\right)}^{2}+{\left(\frac{d}{\mathrm{dt}}\left(\frac{1}{2}{t}^{2}+3\right)\right)}^{2}}\mathrm{dt}\\ =\underset{-2}{\overset{2}{\int }}\sqrt{4+{t}^{2}}\mathrm{dt}\\ =2\underset{0}{\overset{2}{\int }}\sqrt{4+{t}^{2}}\mathrm{dt}\\ t=2s\\ \frac{\mathrm{dt}}{ds}=2\\ t=0,s=0\\ t=2,s=1\\ 2\underset{0}{\overset{2}{\int }}\sqrt{4+{t}^{2}}\mathrm{dt}\\ =2\underset{0}{\overset{1}{\int }}\sqrt{4+4{s}^{2}}\left(2s\right)ds\\ =8·\frac{1}{2}{\left[s\sqrt{1+{s}^{2}}+\mathrm{log}\left(s+\sqrt{1+{s}^{2}}\right)\right]}_{0}^{1}\\ =4\left(\sqrt{2}+\mathrm{log}\left(1+\sqrt{2}\right)\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 = 4 + 2 * t
y = t ** 2 / 2 + 3
I = Integral(sqrt(Derivative(x, t, 1) ** 2 +
Derivative(y, t, 1) ** 2), (t, -2, 2))

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

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

p = plot_parametric((x, y, (t, -5, -2)),
(x, y, (t, -2, 2)),
(x, y, (t, 2, 5)),
legend=True,
show=False)
colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
p[i].line_color = color
p.save('sample6.png')


$python3 sample6.py 2 ⌠ ⎮ ________________________________ ⎮ ╱ 2 ⎮ ╱ 2 ⎛ ⎛ 2 ⎞⎞ ⎮ ╱ ⎛d ⎞ ⎜d ⎜t ⎟⎟ ⎮ ╱ ⎜──(2⋅t + 4)⎟ + ⎜──⎜── + 3⎟⎟ dt ⎮ ╲╱ ⎝dt ⎠ ⎝dt⎝2 ⎠⎠ ⌡ -2 -2⋅log(-1 + √2) + 2⋅log(1 + √2) + 4⋅√2 9.182348597570552 9.182348597570552$