2019年2月22日金曜日

学習環境

解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第3部(積分)、第13章(積分の応用)、補充問題、回転体の体積の練習問題5の解答を求めてみる。


  1. 1 3 π y 2 dx = π 1 3 1 x 2 dx = - π [ 1 x ] 1 3 = - π 1 3 - 1 = 2 3 π

コード

Python 3

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

x = symbols('x')
y = 1 / x
x1 = 1
x2 = 3
I = Integral(pi * y ** 2, (x, x1, x2))

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

p = plot((y, (x, 0.1, x1)),
         (y, (x, x1, x2)),
         (y, (x, x2, 4)),
         legend=True, show=False)
colors = ['red', 'green', 'blue']
for s, color in zip(p, colors):
    s.line_color = color

p.show()
p.save('sample5.png')

入出力結果(cmd(コマンドプロンプト)、Terminal、Jupyter(IPython))

C:\Users\...> py -3 sample5.py
3      
⌠      
⎮ π    
⎮ ── dx
⎮  2   
⎮ x    
⌡      
1      

2⋅π
───
 3 


C:\Users\...>

0 コメント:

コメントを投稿