学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第4部(級数)、第14章(テイラーの公式)、3(三角関数)の練習問題6の解答を求めてみる。
求める4次のテイラー多項式。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, tan, factorial, Derivative, plot
print('6.')
x = symbols('x')
f = tan(x)
g = sum([Derivative(f, x, i).subs({x: 0}) * x ** i / factorial(i)
for i in range(5)])
for o in [g, g.doit()]:
pprint(o)
print()
p = plot(tan(x), g.doit(), ylim=(-10, 10), show=False, legend=True)
colors = ['red', 'green', 'blue']
for o, color in zip(p, colors):
o.line_color = color
p.show()
p.save('sample6.png')
入出力結果(cmd(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py -3 sample6.py
6.
⎛ 4 ⎞│ ⎛ 3 ⎞│ ⎛ 2 ⎞│
4 ⎜ d ⎟│ 3 ⎜ d ⎟│ 2 ⎜ d ⎟│
x ⋅⎜───(tan(x))⎟│ x ⋅⎜───(tan(x))⎟│ x ⋅⎜───(tan(x))⎟│
⎜ 4 ⎟│ ⎜ 3 ⎟│ ⎜ 2 ⎟│
⎝dx ⎠│x=0 ⎝dx ⎠│x=0 ⎝dx ⎠│x=0 ⎛d
──────────────────── + ──────────────────── + ──────────────────── + x⋅⎜──(tan
24 6 2 ⎝dx
⎞│
(x))⎟│
⎠│x=0
3
x
── + x
3
C:\Users\...>
0 コメント:
コメントを投稿