学習環境
解析入門(上)
(松坂和夫
数学入門シリーズ 4) (松坂
和夫(著)、岩波書店)の第8章(積分の計算)、8.2(定積分の計算)、問題8の解答を求めてみる。
#!/usr/bin/env python3
from sympy import pprint, symbols, Integral, log, exp, sin, pi, oo, plot, Limit
print('8.')
x = symbols('x', real=True)
f = exp(-x) * abs(sin(x))
g = log(sin(x))
xs = [(0, oo),
(0, pi / 2)]
for h, (x1, x2) in zip([f, g], xs):
I = Integral(h, (x, x1, x2))
for o in [I, I.doit()]:
pprint(o)
print()
p = plot(f, g,
(x, 0.1, 10),
ylim=(-5, 5),
legend=True,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for o, color in zip(p, colors):
o.line_color = color
p.show()
p.save('sample8.png')
0 コメント:
コメントを投稿