## 2019年1月12日土曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 曲線の長さ(対数関数、指数関数、置換積分法、部分分す分解、微分、平方根)

1. $\begin{array}{}\int \sqrt{1+{\left(\frac{d}{\mathrm{dx}}\mathrm{log}x\right)}^{2}}\mathrm{dx}\\ =\int \sqrt{1+\frac{1}{{x}^{2}}}\mathrm{dx}\\ t=\sqrt{{x}^{2}+1}\\ x=1,t=\sqrt{2}\\ x={e}^{2},t=\sqrt{{e}^{4}+1}\\ {\left[t\right]}_{\sqrt{2}}^{\sqrt{{e}^{4}+1}}+\frac{1}{2}{\left[\mathrm{log}\frac{t-1}{t+1}\right]}_{\sqrt{2}}^{\sqrt{{e}^{4}+1}}\\ =\sqrt{{e}^{4}+1}-\sqrt{2}+\frac{1}{2}\left(\mathrm{log}\frac{\sqrt{{e}^{4}+1}-1}{\sqrt{{e}^{4}+1}+1}-\mathrm{log}\frac{\sqrt{2}-1}{\sqrt{2}+1}\right)\\ =\sqrt{{e}^{4}+1}-\sqrt{2}+\frac{1}{2}\left(\mathrm{log}\frac{{\left(\sqrt{{e}^{4}+1}-1\right)}^{2}}{{e}^{4}}-\mathrm{log}{\left(\sqrt{2}-1\right)}^{2}\right)\\ =\sqrt{{e}^{4}+1}-\sqrt{2}+\frac{1}{2}\mathrm{log}\frac{{\left(\sqrt{{e}^{4}+1}-1\right)}^{2}}{{e}^{4}{\left(\sqrt{2}-1\right)}^{2}}\\ =\sqrt{{e}^{4}+1}-\sqrt{2}+\mathrm{log}\frac{\sqrt{{e}^{4}+1}-1}{{e}^{2}\left(\sqrt{2}-1\right)}\end{array}$

コード

Python 3

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

x = symbols('x')

f = log(x)
I = Integral(sqrt(1 + Derivative(f, x, 1) ** 2), (x, 1, exp(2)))

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

p = plot((f, (x, 0.1, 1)),
(f, (x, 1, exp(2))),
(f, (x, exp(2), 10)),
legend=True, show=False)
colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
p[i].line_color = color
p.save('sample3.png')

for t in [I.doit(),
sqrt(exp(4) + 1) - sqrt(2) + log((sqrt(exp(4) + 1) - 1) /
(exp(2) * (sqrt(2) - 1)))]:
print(float(t))


$./sample3.py 2 ℯ ⌠ ⎮ ___________________ ⎮ ╱ 2 ⎮ ╱ ⎛d ⎞ ⎮ ╱ ⎜──(log(x))⎟ + 1 dx ⎮ ╲╱ ⎝dx ⎠ ⌡ 1 ________ ╱ 4 ⎛ ⎛ -2⎞ ⎞ 4 ╲╱ 1 + ℯ ⋅⎝-√2 - asinh⎝ℯ ⎠ + log(1 + √2)⎠ + 1 + ℯ ───────────────────────────────────────────────────── ________ ╱ 4 ╲╱ 1 + ℯ 6.788651200394834 6.788651200394834$