2019年4月23日火曜日

学習環境

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


  1. lim x 0 tan x sin x = lim x 0 sin x cos x · 1 sin x = lim x 0 1 cos x = 1

コード

Python 3

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

print('7.')

x = symbols('x')
f = tan(x) / sin(x)
l = Limit(f, x, 0)

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

p = plot(tan(x), sin(x), f,
         ylim=(-10, 10),
         show=False,
         legend=True)

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('sample7.png')

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

C:\Users\...>py sample7.py
7.
     ⎛tan(x)⎞
 lim ⎜──────⎟
x─→0⁺⎝sin(x)⎠

1

     ⎛tan(x)⎞
 lim ⎜──────⎟
x─→0⁻⎝sin(x)⎠

1


C:\Users\...>

0 コメント:

コメントを投稿