学習環境
- Surface Go、タイプ カバー、ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第3部(積分)、第13章(積分の応用)、補充問題、曲線の長さの練習問題13の解答を求めてみる。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, Derivative, plot, sqrt, cos, sin
from sympy import pi
from sympy.plotting import plot_parametric
a = symbols('a', positive=True)
t = symbols('t')
x = a * (1 - cos(t))
y = a * (t - sin(t))
I = Integral(sqrt(Derivative(x, t, 1) ** 2 +
Derivative(y, t, 1) ** 2), (t, 0, pi))
for o in [I, I.doit(), I.doit()]:
pprint(o.simplify())
print()
I = 2 * a * Integral(sqrt(sin(t / 2) ** 2), (t, 0, pi))
for o in [I, I.doit()]:
pprint(o)
print()
xa = x.subs({a: 2})
ya = y.subs({a: 2})
p = plot_parametric((xa, ya, (t, -2 * pi, 0)),
(xa, ya, (t, 0, pi)),
(xa, ya, (t, pi, 2 * pi)),
show=False)
colors = ['red', 'green', 'blue']
for i, color in enumerate(colors):
p[i].line_color = color
p.save('sample13.png')
入出力結果(Terminal、cmd(コマンドプロンプト)、Jupyter(IPython))
$ python3 sample13.py
π
⌠
⎮ ______________________________________________
⎮ ╱ 2 2
⎮ ╱ ⎛∂ ⎞ ⎛∂ ⎞
⎮ ╱ ⎜──(a⋅(t - sin(t)))⎟ + ⎜──(-a⋅cos(t) + a)⎟ dt
⎮ ╲╱ ⎝∂t ⎠ ⎝∂t ⎠
⌡
0
π
⌠
⎮ _______________
a⋅⎮ ╲╱ -2⋅cos(t) + 2 dt
⌡
0
π
⌠
⎮ _______________
a⋅⎮ ╲╱ -2⋅cos(t) + 2 dt
⌡
0
π
⌠
⎮ _________
⎮ ╱ 2⎛t⎞
2⋅a⋅⎮ ╱ sin ⎜─⎟ dt
⎮ ╲╱ ⎝2⎠
⌡
0
4⋅a
$
0 コメント:
コメントを投稿