## 2019年2月27日水曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 回転体の体積(対数関数、置換積分法、部分積分法、累乗と指数関数の積、図形をx軸の周りに回転してできる立体の体積)

1. $\begin{array}{}\underset{1}{\overset{2}{\int }}\pi {y}^{2}\mathrm{dx}\\ =\pi \underset{1}{\overset{2}{\int }}{\left(\mathrm{log}x\right)}^{2}\mathrm{dx}\\ t=\mathrm{log}x\\ \frac{\mathrm{dt}}{\mathrm{dx}}=\frac{1}{x}\\ \mathrm{log}2\\ \pi \underset{\mathrm{log}1}{\int }{t}^{2}x\mathrm{dt}\\ =\pi \underset{\mathrm{log}1}{\overset{\mathrm{log}2}{\int }}{t}^{2}{e}^{t}\mathrm{dt}\\ \int {t}^{2}{e}^{t}\mathrm{dt}\\ ={t}^{2}{e}^{t}-\int 2t{e}^{t}\mathrm{dt}\\ ={t}^{2}{e}^{t}-2\left(t{e}^{t}-\int {e}^{t}\mathrm{dt}\right)\\ ={t}^{2}{e}^{t}-2t{e}^{t}+2{e}^{t}\\ ={e}^{t}\left({t}^{2}-2t+2\right)\end{array}$

よって求める回転体の体積は、

$\begin{array}{}\pi \left({e}^{\mathrm{log}2}\left({\left(\mathrm{log}2\right)}^{2}-2\mathrm{log}2+2\right)-{e}^{\mathrm{log}1}\left({\left(\mathrm{log}1\right)}^{2}-2\mathrm{log}1+2\right)\right)\\ =\pi \left(2\left({\left(\mathrm{log}2\right)}^{2}-2\mathrm{log}2+2\right)-2\right)\\ =2\pi \left({\left(\mathrm{log}2\right)}^{2}-2\mathrm{log}2+1\right)\end{array}$

コード

Python 3

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

x = symbols('x')
f = log(x)
x1, x2 = 1, 2

I = Integral(pi * f ** 2, (x, x1, x2))

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

x0 = 0.1
x3 = 10
p = plot((f, (x, x0, x1)),
(f, (x, x1, x2)),
(f, (x, x2, x3)),
legend=True, show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange', 'purple']
for s, color in zip(p, colors):
s.line_color = color

p.show()
p.save('sample10.png')


C:\Users\...> py -3 sample10.py
2
⌠
⎮      2
⎮ π⋅log (x) dx
⌡
1

⎛             2       ⎞
2⋅π⋅⎝-log(4) + log (2) + 1⎠

C:\Users\...>