2019年4月8日月曜日

学習環境

解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第4部(級数)、第14章(テイラーの公式)、4(指数関数)の練習問題11-(a)の解答を求めてみる。



    1. e x = 1 + x + 1 2 ! x 2 + 1 3 ! x 3 + 1 4 ! x 4 + 1 5 ! x 5 + R 6 x R 6 x e · x 6 6 ! 3 · x 6 6 ! e x - 1 x = 1 + 1 2 ! x + 1 3 ! x 2 + 1 4 ! x 3 + 1 5 ! x 4 + R 6 x x R 6 x x 3 · x 5 6 ! = x 5 6 · 5 · 4 · 2 0 1 e x - 1 x dx = x + 1 2 · 2 x 2 + 1 3 · 3 ! x 3 + 1 4 · 4 ! x 4 + 1 5 · 5 ! x 5 1 + 0 1 R 6 x x dx 0 1 R 6 x x dx 0 1 x 5 6 · 5 · 4 · 2 dx = 1 6 · 6 · 5 · 4 · 2 = 1 1440 < 1 0 - 3

      よって、求める積分の小数第3位までの値は

      1 + 1 2 · 2 + 1 3 · 3 ! + 1 4 · 4 ! + 1 5 · 5 ! = 2 · 3 · 4 · 5 · 5 ! + 3 · 4 · 5 · 5 · 4 · 3 + 2 · 4 · 5 · 5 · 4 + 2 · 3 · 5 · 5 + 2 · 3 · 4 2 · 3 · 4 · 5 · 5 ! = 14400 + 3600 + 800 + 150 + 24 14400 = 18974 14400 = 1.317

コード

Python 3

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

print('11-(a).')

x = symbols('x')
f = (exp(x) - 1) / x
g = Integral(f, (x, 0, 1))

for o in [g, g.doit(), float(g.doit())]:
    pprint(o)
    print()

p = plot(f, exp(x), exp(x) - 1,
         (x, -5, 5),
         ylim=(-5, 5),
         show=False, legend=True)
colors = ['red', 'green', 'blue', 'brown']

for s, color in zip(p, colors):
    s.line_color = color

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

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

C:\Users\...>py sample11.py
11-(a).
1          
⌠          
⎮  x       
⎮ ℯ  - 1   
⎮ ────── dx
⎮   x      
⌡          
0          

-γ + Ei(1)

1.3179021514544038


C:\Users\...>

0 コメント:

コメントを投稿