学習環境
- Surface
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門(上) (松坂和夫 数学入門シリーズ 4) (松坂 和夫(著)、岩波書店)の第8章(積分の計算)、8.2(定積分の計算)、問題6の解答を求めてみる。
とおくと、
場合分け。
の場合、
また、
の場合、
また、
の場合、
コード
#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, sqrt, sin, cos, oo, pi, plot
print('6.')
x, a = symbols('x, a', real=True)
f = 1 / ((x + a) * sqrt(x ** 2 - 1))
g = sin(x) / sqrt(1 + 2 * a * cos(x) + a ** 2)
xs = [(1, oo), (0, pi)]
for i, (h, (x1, x2)) in enumerate(zip([f, g], xs), 1):
print(f'({i})')
I = Integral(h, (x, x1, x2))
for o in [I, I.doit()]:
pprint(o.simplify())
print()
p = plot(*[h.subs({a: a0})
for h in [f, g]
for a0 in range(-2, 3)],
(x, -5, 5),
ylim=(-5, 5),
legend=False,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for o, color in zip(p, colors):
o.line_color = color
for o in zip(p, colors):
pprint(o)
print()
p.show()
p.save('sample6.png')
入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))
% ./sample6.py
6.
(1)
∞
⌠
⎮ 1
⎮ ─────────────────── dx
⎮ ________
⎮ ╱ 2
⎮ (a + x)⋅╲╱ x - 1
⌡
1
⎧⎧a⋅(2⋅acosh(│a│) - ⅈ⋅π) + ⅈ⋅π⋅│a│ 2
⎪⎪──────────────────────────────── for a > 1
⎪⎪ ________
⎪⎪ ╱ 2
⎪⎪ 2⋅╲╱ a - 1 ⋅│a│
⎪⎪
⎪⎨ π⋅│a│ for 2⋅│arg(a)│ < 2⋅π
⎪⎪ -a⋅asin(│a│) + ─────
⎪⎪ 2
⎪⎪ ──────────────────── otherwise
⎪⎪ ________
⎨⎪ ╱ 2
⎪⎩ ╲╱ 1 - a ⋅│a│
⎪
⎪ ∞
⎪ ⌠
⎪ ⎮ 1
⎪ ⎮ ─────────────────── dx otherwise
⎪ ⎮ ________
⎪ ⎮ ╱ 2
⎪ ⎮ (a + x)⋅╲╱ x - 1
⎪ ⌡
⎩ 1
(2)
π
⌠
⎮ sin(x)
⎮ ──────────────────────── dx
⎮ _____________________
⎮ ╱ 2
⎮ ╲╱ a + 2⋅a⋅cos(x) + 1
⌡
0
⎧ ______________ ______________
⎪ ╱ 2 ╱ 2
⎪- ╲╱ a - 2⋅a + 1 + ╲╱ a + 2⋅a + 1
⎨─────────────────────────────────────── for a ≠ 0
⎪ a
⎪
⎩ 2 otherwise
(cartesian line: 1/((x - 2)*sqrt(x**2 - 1)) for x over (-5.0, 5.0), red)
(cartesian line: 1/((x - 1)*sqrt(x**2 - 1)) for x over (-5.0, 5.0), green)
(cartesian line: 1/(x*sqrt(x**2 - 1)) for x over (-5.0, 5.0), blue)
(cartesian line: 1/((x + 1)*sqrt(x**2 - 1)) for x over (-5.0, 5.0), brown)
(cartesian line: 1/((x + 2)*sqrt(x**2 - 1)) for x over (-5.0, 5.0), orange)
(cartesian line: sin(x)/sqrt(5 - 4*cos(x)) for x over (-5.0, 5.0), purple)
(cartesian line: sin(x)/sqrt(2 - 2*cos(x)) for x over (-5.0, 5.0), pink)
(cartesian line: sin(x) for x over (-5.0, 5.0), gray)
(cartesian line: sin(x)/sqrt(2*cos(x) + 2) for x over (-5.0, 5.0), skyblue)
(cartesian line: sin(x)/sqrt(4*cos(x) + 5) for x over (-5.0, 5.0), yellow)
%
0 コメント:
コメントを投稿