## 2019年2月26日火曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 回転体の体積(指数関数、逆数、図形をx軸の周りに回転してできる立体の体積)

1. $\begin{array}{}\underset{1}{\overset{5}{\int }}\pi {y}^{2}\mathrm{dx}\\ =\pi \underset{1}{\overset{5}{\int }}{\left({e}^{-x}\right)}^{2}\mathrm{dx}\\ =\pi \underset{1}{\overset{5}{\int }}{e}^{-2x}\mathrm{dx}\\ =\pi {\left[-\frac{1}{2}{e}^{-2x}\right]}_{1}^{5}\\ =-\frac{1}{2}\pi \left({e}^{-10}-{e}^{-2}\right)\\ =\frac{\pi }{2}\left({e}^{-2}-{e}^{-10}\right)\end{array}$

コード

Python 3

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

x = symbols('x')
f = exp(-x)
x1, x2 = 1, 5

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

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

x0 = 0
x3 = 6
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('sample9.png')


C:\Users\...> py -3 sample9.py
5
⌠
⎮    -2⋅x
⎮ π⋅ℯ     dx
⌡
1

-10      -2
π⋅ℯ      π⋅ℯ
- ────── + ─────
2        2

C:\Users\...>