2019年6月29日土曜日

学習環境

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


  1. f x = 1 - x 1 3 - 1 + 1 3 x d dx f x = 1 3 1 - x - 2 3 - 1 + 1 3 = - 1 3 1 - x - 2 3 + 1 3 d 2 d x 2 f x = 2 3 2 1 - x - 5 3 - 1 = - 2 3 2 1 - x - 5 3 d 3 d x 3 f x = - 2 · 5 3 3 1 - x - 8 3 f x = - 1 2 ! · 2 3 2 x 2 - 1 3 ! · 2 · 5 3 3 x 3 - lim x 0 1 - x 1 3 - 1 + 1 3 x x 2 = - 1 2 ! 2 3 2 = - 1 9

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, plot, Limit, Rational

print('32.')

x = symbols('x')
f = ((1 - x) ** Rational(1, 3) - 1 + x / 3) / x ** 2

for d in ['+', '-']:
    l = Limit(f, x, 0, dir=d)
    for o in [l, l.doit()]:
        pprint(o)
        print()

p = plot((1 - x) ** Rational(1, 3), x / 3,
         (1 - x) ** Rational(1, 3) - 1 + x / 3, x ** 2,
         ((1 - x) ** Rational(1, 3) - 1 + x / 3) / x ** 2,
         (x, -1.5, 1.5),
         ylim=(-2, 2),
         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('sample32.png')

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

C:\Users\...>py sample32.py
32.
     ⎛x   3 _______    ⎞
     ⎜─ + ╲╱ 1 - x  - 1⎟
     ⎜3                ⎟
 lim ⎜─────────────────⎟
x─→0⁺⎜         2       ⎟
     ⎝        x        ⎠

-1/9

     ⎛x   3 _______    ⎞
     ⎜─ + ╲╱ 1 - x  - 1⎟
     ⎜3                ⎟
 lim ⎜─────────────────⎟
x─→0⁻⎜         2       ⎟
     ⎝        x        ⎠

-1/9


C:\Users\...>

0 コメント:

コメントを投稿