## 2019年2月1日金曜日

### 数学 - Python - 解析学 - 積分 - 積分の応用 - 面積(三角関数(余弦)、極座標表示)

1. $\begin{array}{}\underset{-\frac{\pi }{2}}{\overset{\frac{\pi }{2}}{\int }}\frac{\pi {r}^{2}}{2\pi }d\theta \\ =\underset{-\frac{\pi }{2}}{\overset{\frac{\pi }{2}}{\int }}\frac{1}{2}·{\left(10\mathrm{cos}\theta \right)}^{2}d\theta \\ =50\underset{-\frac{\pi }{2}}{\overset{\frac{\pi }{2}}{\int }}{\mathrm{cos}}^{2}\theta d\theta \\ =50\left(\frac{1}{2}{\left[\mathrm{cos}\theta \mathrm{sin}\theta \right]}_{-\frac{\pi }{2}}^{\frac{\pi }{2}}+\frac{1}{2}\underset{-\frac{\pi }{2}}{\overset{\frac{\pi }{2}}{\int }}1d\theta \right)\\ =50·\frac{1}{2}·\left(\frac{\pi }{2}+\frac{\pi }{2}\right)\\ =25\pi \end{array}$

コード

Python 3

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

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

I = Integral(r ** 2 / 2, (theta, -pi / 2, pi / 2))

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

p = plot_parametric((x, y, (theta, -pi / 2, 0)),
(x, y, (theta, 0, pi / 2)),
show=False)

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


$python3 sample20.py π ⌠ ⎮ ⎛θ⎞ ⎮ sin⎜─⎟ dθ ⎮ ⎝2⎠ ⌡ 0 2$