2019年1月15日火曜日

数学 - Python - 解析学 - 積分 - 積分の応用 - 曲線の長さ(累乗(べき乗、平方)、放物線、微分、対数関数、平方根)

1. $\begin{array}{}\frac{d}{\mathrm{dx}}\left(x\sqrt{4{x}^{2}+1}\right)\\ =\sqrt{4{x}^{2}+1}+\frac{4{x}^{2}}{\sqrt{4{x}^{2}+1}}\\ \frac{d}{\mathrm{dx}}\mathrm{log}\sqrt{4{x}^{2}+1}\\ =\frac{1}{\sqrt{4{x}^{2}+1}}·\frac{4x}{\sqrt{4{x}^{2}+1}}\\ \frac{d}{\mathrm{dx}}\mathrm{log}\left(2x+\sqrt{4{x}^{2}+1}\right)\\ =\frac{1}{2x+\sqrt{4{x}^{2}+1}}\left(2+\frac{4x}{\sqrt{4{x}^{2}+1}}\right)\\ =\frac{1}{2x+\sqrt{4{x}^{2}+1}}·\frac{2\left(\sqrt{4{x}^{2}+1}+2x\right)}{\sqrt{4{x}^{2}+1}}\\ =\frac{2}{\sqrt{4{x}^{2}+1}}\\ \frac{1}{2}\frac{d}{\mathrm{dx}}\left(x\sqrt{4{x}^{2}+1}+\frac{1}{2}\mathrm{log}\left(2x+\sqrt{4{x}^{2}+1}\right)\right)\\ =\frac{1}{2}\left(\sqrt{4{x}^{2}+1}+\frac{4{x}^{2}}{\sqrt{4{x}^{2}+1}}+\frac{1}{\sqrt{4{x}^{2}+1}}\right)\\ =\frac{1}{2}\left(\sqrt{4{x}^{2}+1}+\frac{4{x}^{2}+1}{\sqrt{4{x}^{2}+1}}\right)\\ =\frac{1}{2}\left(\sqrt{4{x}^{2}+1}+\sqrt{4{x}^{2}+1}\right)\\ =\sqrt{4{x}^{2}+1}\end{array}$

よって、求める曲線の指示された区間における長さは、

$\begin{array}{}{\int }_{-2}^{2}\sqrt{1+{\left(\frac{d}{\mathrm{dx}}\left(4-{x}^{2}\right)\right)}^{2}}\mathrm{dx}\\ =2\underset{0}{\overset{2}{\int }}\sqrt{1+4{x}^{2}}\mathrm{dx}\\ =2·\frac{1}{2}{\left[x\sqrt{4{x}^{2}+1}+\frac{1}{2}\mathrm{log}\left(2x+\sqrt{4{x}^{2}+1}\right)\right]}_{0}^{2}\\ =2\sqrt{17}+\frac{1}{2}\mathrm{log}\left(4+\sqrt{17}\right)\end{array}$

コード

Python 3

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

x = symbols('x')

f = 4 - x ** 2
I = Integral(sqrt(1 + Derivative(f, x, 1) ** 2), (x, -2, 2))

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

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

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


$./sample4.py 2 ⌠ ⎮ _____________________ ⎮ ╱ 2 ⎮ ╱ ⎛d ⎛ 2 ⎞⎞ ⎮ ╱ ⎜──⎝- x + 4⎠⎟ + 1 dx ⎮ ╲╱ ⎝dx ⎠ ⌡ -2 asinh(4) ──────── + 2⋅√17 2 9.293567524865871 9.293567524865871$