## 2019年1月25日金曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 曲線の長さ(極座標表示、累乗(べき乗、平方)、平方根)

1. $\begin{array}{}{\left(\frac{d}{d\theta }\left(r\mathrm{cos}\theta \right)\right)}^{2}+{\left(\frac{d}{d\theta }\left(r\mathrm{sin}\theta \right)\right)}^{2}\\ ={\left(\frac{dr}{d\theta }\mathrm{cos}\theta -r\mathrm{sin}\theta \right)}^{2}+{\left(\frac{dr}{d\theta }\mathrm{sin}\theta +r\mathrm{cos}\theta \right)}^{2}\\ ={\left(\frac{dr}{d\theta }\right)}^{2}{\mathrm{cos}}^{2}\theta -2r\mathrm{sin}\theta \mathrm{cos}\theta \frac{dr}{d\theta }+{r}^{2}{\mathrm{sin}}^{2}\theta \\ +{\left(\frac{dr}{d\theta }\right)}^{2}{\mathrm{sin}}^{2}\theta +2r\mathrm{cos}\theta \mathrm{sin}\theta \frac{dr}{d\theta }+{r}^{2}{\mathrm{cos}}^{2}\theta \\ ={r}^{2}+{\left(\frac{dr}{d\theta }\right)}^{2}\end{array}$

求める曲線の長さ。

$\begin{array}{}{\int }_{1}^{2}\sqrt{{\left(3{\theta }^{2}\right)}^{2}+{\left(\frac{d}{d\theta }\left(3{\theta }^{2}\right)\right)}^{2}}d\theta \\ ={\int }_{1}^{2}\sqrt{9{\theta }^{4}+{\left(6\theta \right)}^{2}}d\theta \\ ={\int }_{1}^{2}\sqrt{9{\theta }^{4}+36{\theta }^{2}}d\theta \\ ={\int }_{1}^{2}3\theta \sqrt{{\theta }^{2}+4}d\theta \\ ={\left[\frac{3}{2}\frac{2}{3}{\left({\theta }^{2}+4\right)}^{\frac{3}{2}}\right]}_{1}^{2}\\ ={8}^{\frac{3}{2}}-{5}^{\frac{3}{2}}\\ ={\left(2\sqrt{2}\right)}^{3}-{5}^{\frac{3}{2}}\\ =16\sqrt{2}-{5}^{\frac{3}{2}}\end{array}$

コード

Python 3

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

theta = symbols('θ')
r = 3 * theta ** 2
x = r * cos(theta)
y = r * sin(theta)

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

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

for o in [I.doit(), 8 ** Rational(3, 2) - 5 ** Rational(3, 2)]:
print(float(o))

p = plot_parametric((x, y, (theta, -4 * pi, 1)),
(x, y, (theta, 1, 2)),
(x, y, (theta, 2, 4 * pi)),
show=False)

colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
p[i].line_color = color
p.save('sample14.png')


$python3 sample14.py 2 ⌠ ⎮ _________________________________________ ⎮ ╱ 2 2 ⎮ ╱ ⎛d ⎛ 2 ⎞⎞ ⎛d ⎛ 2 ⎞⎞ ⎮ ╱ ⎜──⎝3⋅θ ⋅sin(θ)⎠⎟ + ⎜──⎝3⋅θ ⋅cos(θ)⎠⎟ dθ ⎮ ╲╱ ⎝dθ ⎠ ⎝dθ ⎠ ⌡ 1 2 ⌠ ⎮ _____________ ⎮ ╱ 2 ⎛ 2 ⎞ 3⋅⎮ ╲╱ θ ⋅⎝θ + 4⎠ dθ ⌡ 1 11.447077110470572 11.447077110470572$