Loading [MathJax]/jax/output/CommonHTML/jax.js

2019年7月5日金曜日

学習環境

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


  1. f(x)=cosx-1-x22!f'(x)=-sinx-xf(2)(x)=-sinx-1f(3)(x)=-cosxf(4)(x)=sinxf(5)(x)=cosxf(6)(x)=-sinxf(7)(x)=-cosxf(x)=-12!x2-13!x3+15!x5-limx0cosx-1-x22!x=0

コード

Python 3

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

print('38.')

x = symbols('x')
f = (cos(x) - 1 - x ** 2 / factorial(2)) / x

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

p = plot(cos(x) - 1 - x ** 2, x, f,
         (x, -5, 5),
         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('sample38.png')

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

C:\Users\...>py sample38.py
38.
     ⎛   2             ⎞
     ⎜  x              ⎟
     ⎜- ── + cos(x) - 1⎟
     ⎜  2              ⎟
 lim ⎜─────────────────⎟
x─→0⁺⎝        x        ⎠

0

     ⎛   2             ⎞
     ⎜  x              ⎟
     ⎜- ── + cos(x) - 1⎟
     ⎜  2              ⎟
 lim ⎜─────────────────⎟
x─→0⁻⎝        x        ⎠

0


C:\Users\...>

0 コメント:

コメントを投稿